Комментарии:
Thanks for this much of good content ❤
Ответитьwhat about 2d arrays?
Ответитьhello is it possible to do it inside of a function isntead of main ?
ОтветитьThose various methods of passing length of arrays may all be used but with caution. A code having thousends of lines with error resulting from passing global as local value may give the developer nightmare trying to find the problem. One should pay attention to which method to use before deploying the code and implement new customer requirements in the code at later time. To be in the safe side I would define the size of the array along with the array before sending them for execution - every time, yes every time. For example: to command the wireless controller go into "COMMAND" mode I send the array (pointed to by a pointer *) making up the command bytes as bytes and send along with it the number of bytes and ask the responsible subroutine to process them, this gives me peace of mind. Now even if the customer request new changes later then the code can still work without any problem.
ОтветитьThank you Kevin for explaining the method to find size of array. Those C programming tips are very useful for embedded engineers like myself. I use them a lot in wireless and wired communications and user interface. Examples are communicating over the Bluetooth Low Energy (BLE), USART VCP port COMM, Electronic Control Panels, Robotics, Electronic displays and the like.
ОтветитьWhat is difference between size of an array and length of an array?
ОтветитьThis is one of the best coding videos I have ever watched
ОтветитьThat's an amazing video! Can you also make a video about a tictactoe game so I can finally understand how to build it :D
ОтветитьI have a question.
Is it possible we allow user to enter the number of elements in a array
And program tells how many numbers user has entered ?
If possible then how? Please let me know.
I don't want to initialise the array , just want to take user input and print how many elements user entered .
I can understand the concepts of programming in a class but I find it difficult to solve programming problems in a test or exam. Can you tell me why pls?and how can i solve the problems
ОтветитьEach integer is 4bytes so 4x9 =36
and 36 /4=9 right?
the videos you make are so great and well explained sir , can you tell me which IDE are you using ?
ОтветитьThanks! Very Helpful
ОтветитьJefferson Sales done a few but not there yet
ОтветитьDrat. Just when I thought there was a generic length(array) function to be had.
I am beginning to understand the limits of C, and I suppose this is one. That's okey. Nothing is perfect and everything has limits, and that includes computer programming languages.
компилятор ругается на:
- void print_size(int* array) // warning: ‘sizeof’ on array function parameter ‘array’ will return size of ‘int *’ [-Wsizeof-array-argument]
- printf("sizeof(array): %ld\n", sizeof(array)); // warning: format ‘%d’ expects argument of type ‘int’, but argument 2 has type ‘long unsigned int’ [-Wformat=]