Following is my code. Code: //Array passing to Function #include<stdio.h> #include<stdlib.h> void display(int ,int); void main() { int i,ar[10],n; printf("\n Enter the no of no's->"); scanf("%d",&n); for(i=0;i<n;i++) { printf("\n Enter no->"); scanf("%d",&ar[i]); } display(ar[10],n); } void display(int ar[10],int n) { int i; for(i=0;i<n;i++) { printf("\n Enter no->%d",ar[i]); } } It is compiling fine. But when I am pressing Ctrl-F9 to run it, I am getting this error. Undefined symbol display(int,int) in noname00.cpp where my file name is "noname00.cpp". I have tried with other file names, but no success. Please help me finding the error. Thanks.
The problem is not the filename. The problem is that you have prototyped display(int,int) but not defined it. That is why you are getting a missing symbol. The solution is either to define display(int,int), or more likely it's the prototype itself that's wrong and should be defined as void display (int ar[10],int n); Another solution which removes the need for a prototype is to define display() above main(). Prototypes are really only needed (a) in header files for functions you wish to make public, or (b) where two functions call each other.