Wednesday, September 9, 2009

STRING QUESTIONS AND ANSWER IN C


(1) Without using any semicolon (;) in program write a c program which output is: HELLO WORLD?Answer:void main(){if(printf("HELLO WORLD")){}}(2)What will be output of following code?void main(){char a[5];a[0]='q';a[1]='u';a[2]='e';clrscr();printf("%s",a);getch();}Output: garbageExplanation: %s is used for string but a is not a string it is only array of character since its last character is not

No comments:

Post a Comment