which of these are valid or invalid statements.pl

 which of these are valid or invalid statements.please correct them if they are invalid

int c[]={1,2,3,4,5,6,7,8};           

int *p=c[5];

int *p=c;

int p=c;

Arul @innovwelt
10 Jan 2015 08:14 pm

int *p=c[5]; is wrong. we cannot assign an integer to an integer pointer.

correction: int *p=&c[5]; // p holds 'address of c[5]'


int p=c; is wrong. we cannot assign a pointer to an integer.

correction: int p=*c;  // p holds '1'