Halo all,
First of all, I would like to say that this thing called "pointers" is making me sick. Each time I see '*' I get totally confused as to what should I do. So please help me, you can say me a prey of pointers. I want them to understand like you guys here on this forum have done. But still I'm sure I dont know even 0.0001% of it. Here's a code which I cant understand
In this code except for knowing that r is an array of 4 int pointers, I dont know anything, specially when it's passed to the function. Now my questions are:Code:#include<stdio.h>
#include<string.h>
void f(int *a[])
{
printf("%d",(*++a)[0]);
printf("\n%p",(void *)(*++a[0]));
}
int main(void)
{
int i=10,j=20,k=40,l=50;
int *r[4];
r[0]=&i;
r[1]=&j;
r[2]=&k;
r[3]=&l;
f(r);
}
1. what is a[] in the function?
2.How are the outputs coming out to be 20 and CCCCCCCC respectively?
3.When I try to initialize r like this
I get warnings(j,k,l also)Code:int *r[4]={&i,&j,&k,&l};
I also want to say that this code wasn't given anywhere but I was exprimenting with array of pointers and suddenly made the code.Quote:
Warning 2 warning C4221: nonstandard extension used : 'r' : cannot be initialized using address of automatic variable 'i'
Waiting in anticipation
Thanks