Hi,
I wrote a small code to change the values of the entries of data. But it is not changing. Will you please point out my mistake over here ?
The values of data[] are not changing even after function call.
I think there is something to do with passing pointers....
pls help me out..
Thank you
~~~~~~~~~~~~~~~~~~~
Code:#include <stdio.h>
#define size 4
void update(int *);
main(){
int data[]={1,2,3,4};
update(&data[0]);
getchar();
}
void update(int *data)
{
int changed_data[size];
for (int j=0;j<size;j++)
changed_data[j]=j+100;
data=changed_data;
//printf("");
}