For the two expressions char*greeting="Hello." and Static char

saad

Member
Joined
Feb 25, 2008
Messages
51
Reaction score
0
Points
6
greeting[]="Hello.", what is the effect of? statement puts(++greeting)?
 
When greeting is declared as a character pointer, puts(++greeting) will output “ello”. When it is declared as a static char array, the puts(++greeting) should generate a compile time error.
 
#include <stdio.h>

int main(void)
{

char *greetptr = "Hello."
char greet[] = "Hello."

puts(++greetptr);
puts(++greet);

return 0;
}

Compile and run, what do you see on screen, what happened?
 
Back
Top