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

Write a C program to remove the repeated characters in the entered expression or in entered characters(i.e) removing duplicates

3 Answers  


we have to use realloc only after malloc or calloc ? or we can use initially with out depending on whether we are using malloc or calloc in our program ?

2 Answers  


What is a list in c?

0 Answers  


What is the right type to use for boolean values in c?

0 Answers  


Read N characters in to an array . Use functions to do all problems and pass the address of array to function. 2. Enter alphanumeric characters and form 2 array alphaets and digits.Also print the count of each array.

0 Answers  






write a programe to find the factorial of given number using recursion

3 Answers  


What is difference between class and structure?

0 Answers  


convert 0.9375 to binary

2 Answers   CTS, TANCET,


What is difference between structure and union?

0 Answers  


the output will be #include<stdio.h> int main () { int i; i = 9/2; printf("%i",i); return 0; }

4 Answers   CMC, TCS,


Why shouldn’t I start variable names with underscores?

0 Answers  


What is union and structure?

0 Answers  


Categories