How to send an array to a function whose number of rows and columns is unknown? in c language | Sololearn: Learn to code for FREE!
New course! Every coder should learn Generative AI!
Try a free lesson
+ 3

How to send an array to a function whose number of rows and columns is unknown? in c language

How to send an array to a function whose number of rows and columns is unknown? in c language

2nd Jan 2020, 9:55 AM
farkhondeh
1 Answer
+ 1
You can use pointers to do this task As arrays are allocated continuously in memory so all you have to pass to the function is the address of first element of array and just increment or decrement the pointer to acess others OR /*you can also use sizeof() function to find out it's size and then pass it to function*/ EDIT:- I guess Martin Taylor is right, sizeof function returns the size of pointer not the array, thanks for informing me🙂🙃👍
2nd Jan 2020, 10:04 AM
Arsenic
Arsenic - avatar