AD1

Friday, 10 February 2017

What will be the output of the following program

#include <stdio.h>
int main(int argc, char **argv)
{
char s[]="Egypt";
for(int i=0;*("Egypt"+i)!='\0';i++)
{
printf("%c",s[i]);
}
return 0;
}
view raw string.c hosted with ❤ by GitHub
the output is 
Egypt 
explanation 
string name is the base address of the string variable which is an array of characters

No comments:

Post a Comment