Experts there is a question given in the book "Let us C" where the author has asked to write the output of the given program. The program is-
#include<stdio.h>
int main()
{
char s[]="Churchgate: no church no gate";
char t[40];
char *ss,*tt;
ss=s;
while(*ss!='\0')
*tt++=*ss++;
printf("%s\n",t);
return 0;
}
When I tried it on my gcc compiler, the output was core-dumped. Please explain why.Here ss and tt are character pointers. Here I also don't understand that what's the meaning of the statement ss=s; I mean we can't directly copy a string unless we are copying it character by character. And ss is a character pointer so it points to a character then ss=s means what? Does it mean it will point to the byte whose address is the ASCII value of s? I also don't understand this statement *tt++=*ss++. I don't have any clue about it. Please elaborate its meaning.
Next I don't understand why printf("%s\n",t) is used as though t is of character type but it is not storing anything according to the program.