Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations Mike Lewis on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

pointer strings

Status
Not open for further replies.

manichandra

Technical User
Feb 6, 2012
19
US
output of this

_____________________
int main()
{
char s[]="MANI";
char *p;
p=s;
*p = "CUCKOO";

//*(p+1)='C';
//*(p+2) = 'B';
//*(p+3) = 'D';

printf("%s\n",s);
printf("%s\n",p);
return 0;
}

____________________________
is

eANI
eANI


y can't we male p to pint to other straining "CUCKOO" ?
 
Does it even compile?

*p = "CUCKOO" reads char = char*. That won't compile at all

Try

p = "CUCKOO";
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top