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

main() { int i=0; while(+(+i--)!=0) i-=i++; printf("%d",i); }

4 Answers  


Write a program to find minimum between three no.s whithout using comparison operator.

4 Answers   IBM,


explain how do you use macro?

0 Answers  


what is printf

5 Answers   MVSR, Satyam,


input any 4 digit number and find the difference of all the digits?

3 Answers   Google,


#include<stdio.h> int main(){ int a[]={1,2,3,5,1}; int *ptr=a+4; int y=ptr-a; printf("%d",y); }

3 Answers   Zoho,


What are the application of void data type in c?

0 Answers  


#include<stdio.h> #include<conio.h> void main() { float a; clrscr(); a=0.5; if(a==0.5) printf("yes"); else printf("no"); getch(); }

9 Answers   TCS,


Output for following program using for loop only * * * * * * * * * * * * * * *

3 Answers  


A character flag or control mechanism that delineates one data item from another a) variable b) constant c) delimiter d) call by reference

0 Answers  


Did c have any year 2000 problems?

0 Answers  


write a program in c language that uses function to locate and return the smallest and largest integers in an array,number and their position in the array. it should also find and return the range of the numbers , that is , the difference between the largest number and the smallest.

1 Answers  


Categories