GeeksforGeeks » Interview Questions
Interview Question for Software Engineer/Developer about CPuzzles
(3 posts)-
void func1(int (*a)[10]) { printf("Ok it works"); } void func2(int a[][10]) { printf("Will this work?"); } main() { int a[10][10]; func1(a); func2(a); }a) Ok it works
b) Will this work?
c) Ok it worksWill this work?
d) None of the above -
Both the functions doing same. In later case the two dimensional decays to "pointer to array of 10 integers". Similarly the any multidimensional array can be passed omitting the first dimension. Because the "array" passed to function decays to "pointer". All other dimensions except the first are required to find the element using this pointer.
-
c
Reply
You must log in to post.