0 0 votes They have given answer B , but after running this program getting runtime error. Please explain Programming in C ace-test-series programming strings + – Shankar Kakde 888 views answer comment Share Follow Print See 1 comment 1 1 comment reply goxul commented Jun 6, 2018 reply Follow flag char a[] = '\0' is syntactically incorrect. It gives a compilation error with gcc. 1 1 replyShare Please log in or register to add a comment.
3 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 Shaik Masthan answered Jun 6, 2018 Shaik Masthan comment Share Follow 0 reply Please log in or register to add a comment.