A
ankitjain.bvcoe
Hi ,
i don't know why the below mentioned program is giving wrong o/p.
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
ARRAY_SIZE 10
int func(void *x)
{
int (*y)[ARRAY_SIZE];
y=x;
printf("%d, %d",y[0],y[1]);
return 0;}
int main (void)
{
int arr[ARRAY_SIZE]={1,2};
int (*p)[ARRAY_SIZE];
p=&arr;
func(p);
return 0;
}
O/P -10272722,-18928292
i don't know why the below mentioned program is giving wrong o/p.
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
ARRAY_SIZE 10
int func(void *x)
{
int (*y)[ARRAY_SIZE];
y=x;
printf("%d, %d",y[0],y[1]);
return 0;}
int main (void)
{
int arr[ARRAY_SIZE]={1,2};
int (*p)[ARRAY_SIZE];
p=&arr;
func(p);
return 0;
}
O/P -10272722,-18928292