char S;
char S[6]= " HELLO";
printf("%s ",S[6]);

output of the above program ?
(0, ASCII 0, I,unpredictable)

Answers were Sorted based on User's Feedback



char S; char S[6]= " HELLO"; printf("%s ",S[6]); output of the above ..

Answer / kiran kumar

For the Above Program u will get the Error as Conflictinf
types for S because you are declaring 2 variables of
different types one as char and another as char aray with
same names.

So, the compiler will be in Unpredicatable stage
variable name S to be consider for what type and it will
give Error as Confilctinf types for S.

Even if u replace any of the S with s then u will get the
Output of this Program as Segfault in Linux where as in
Windows u will get the HELLO.

To the Best of my Knowledge i Posted this Answer.
Let me Know if there is any better Clarifications.

My emai Id is kirjony@gmail.com

Is This Answer Correct ?    2 Yes 0 No

char S; char S[6]= " HELLO"; printf("%s ",S[6]); output of the above ..

Answer / fazlur

null is the answer.

Is This Answer Correct ?    2 Yes 1 No

char S; char S[6]= " HELLO"; printf("%s ",S[6]); output of the above ..

Answer / divakar & venkatesh

u will get the following error
conflicting types for 'S'

Is This Answer Correct ?    0 Yes 1 No

char S; char S[6]= " HELLO"; printf("%s ",S[6]); output of the above ..

Answer / vignesh1988i

unpredictable..............

Is This Answer Correct ?    0 Yes 1 No

char S; char S[6]= " HELLO"; printf("%s ",S[6]); output of the above ..

Answer / vrushali

The answer is unpredictable....

Is This Answer Correct ?    0 Yes 1 No

char S; char S[6]= " HELLO"; printf("%s ",S[6]); output of the above ..

Answer / prasanth

IT`LL SHOW AS MULTIPLE DECLATION FOS S AND WE`LL NOT OBTAIN
THE OUTPUT

Is This Answer Correct ?    0 Yes 2 No

char S; char S[6]= " HELLO"; printf("%s ",S[6]); output of the above ..

Answer / manishsoni

This gives an error, and prg is terminated.
To slove this problem we show a program..

#include<stdio.h>
#include<conio.h>
int main()
{
char S[6]= "HELLO";
printf("%s",S);
getch();
return 0;
}
this print simple hello.

Is This Answer Correct ?    0 Yes 2 No

Post New Answer

More C Interview Questions

What is C language ?

0 Answers   Jekson,


3. Program to print all possible substrings. ex: String S St Str Stri Strin String t tr tri trin tring r

3 Answers   Huawei,


what is c language?

2 Answers  


What is "Duff's Device"?

0 Answers   Celstream,


how to generate sparse matrix in c

3 Answers  


What is an example of structure?

0 Answers  


give one ip, find out which contry

4 Answers   Google,


Is null always equal to 0(zero)?

0 Answers  


#include<stdio.h> #include<conio.h> void main() { int m=0111,n=20; printf("%d%d\n",m,n); getch(); }

1 Answers  


Are pointers integer?

0 Answers  


Tell us bitwise shift operators?

0 Answers  


wap in c to accept n number display the highest and lowest value

2 Answers  


Categories