edited by
622 views
0 votes
0 votes

They have given answer B , but after running this program getting runtime error. Please explain

edited by

1 Answer

3 votes
3 votes

in this question, 

char a[]='\0' -----> line giving error why because a is a character array not a character if you put \0 in double quotes look like as "\0" it will ok otherwise put \0 in { } look like as { '\0' }

if the line is corrected then the output should be "The string is not empty"   why because printf always return how many characters it printed on stdout, note that printf never print null character. therefore if(printf("%s",a)) equivalent to if(0) ===> condition fails