Problem 3.2:
What does the following program do?
int main()
{
char *p;
for(p = "WNT"; *p; p++) printf("%c", *p - 1);
printf("\n");
return 0;
}
[Solution]
Problem 3.3:
What does the following program do?
int main()
{
char *p;
for(p = "HAL"; *p; p++) printf("%c", *p + 1);
printf("\n");
return 0;
}
[Solution]
Problem 3.4:
Will the following program compile? Will it run?
int main()
{
char *p;
p = p + 500;
return 0;
}
[Solution]
Problem 3.5:
Does the following code compile? What does it do?
int main()
{
char word[] = ;
char *spark[10];
int i;
for(i=0; i<10; i) spark[i] = word + (i % 5);
for(i=0; i<10; i) printf("%c", *spark[i]);
printf("\n");
return 0;
}
[Solution]