how does a general function , that accepts an array as a
parameter, "knows" the size of the array ?
How should it define it parameters list ?

Answers were Sorted based on User's Feedback



how does a general function , that accepts an array as a parameter, "knows" the size of ..

Answer / ilana

one option :
myfunc (int my_array[], int n ) { ...}

another option:
myfunc (int *my_array, int n ) { ...}

Is This Answer Correct ?    12 Yes 5 No

how does a general function , that accepts an array as a parameter, "knows" the size of ..

Answer / ganesh bankar

its compilers job to identify what is the size the array
depending upon which array is passed to the function.

Is This Answer Correct ?    7 Yes 1 No

Post New Answer

More C Interview Questions

#include main() { enum _tag{ left=10, right, front=100, back}; printf("left is %d, right is %d, front is %d, back is %d",left,right,front,back); }

0 Answers   Wilco,


What is true about the following C Functions (a) Need not return any value (b) Should always return an integer (c) Should always return a float (d) Should always return more than one value

2 Answers   DynPro, TCS,


Why do we need arrays in c?

0 Answers  


What are local static variables?

0 Answers  


What is the diffences between Windows XP and Windows Visa

1 Answers   Aricent, FHF,






What are the storage classes in C?

0 Answers  


What is typedef example?

0 Answers  


Dear Sir, we are required the bubble sorting programs Regs Prem

1 Answers  


What is the use of a semicolon (;) at the end of every program statement?

1 Answers  


what is computer engg

1 Answers  


#define MAX 3 main() { printf("MAX = %d \n",MAX ); #undef MAX #ifdef MAX printf("Vector Instituteā€); #endif

4 Answers   IBM, Vector,


how does the C compiler interpret the following two statements p=p+x; q=q+y; a.p=p+x; q=q+y b.p=p+xq=q+y c.p=p+xq; q=q+y d.p=p+x/q=q+y

4 Answers   TCS,


Categories