Passing Array To A Function Using Pointer In C
hey guys!
i have a small trouble, hope it'll be solved soon here..
facing problem in passing array to a function using pointer.
while compiling in borland c it says "Processor fault"
and in DEV C it compiles but doesn't give any output
here's the code
i have a small trouble, hope it'll be solved soon here..
facing problem in passing array to a function using pointer.
while compiling in borland c it says "Processor fault"
and in DEV C it compiles but doesn't give any output
here's the code
#include<stdio.h>
#include<conio.h>
void passarray(int *,int);
int main()
{
const int size=10;
int a[size];
printf("Enter the elements= ");
for(int i=0;i<size;i++)
scanf("%d",a[i]);
passarray(a,size);
getch();
return 0;
}
void passarray(int *x,int y)
{
for(int i=0;i<y;i++)
printf("%d",*(x+i));
}
0