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 are the advanced features of functions a) function declaration and prototypes b) calling functions by value or by reference c) recursion d) all the above

0 Answers  


What is union and structure in c?

0 Answers  


Hai what is the different types of versions and their differences

0 Answers  


write a program to generate 1st n fibonacci prime number

12 Answers  


swapping of two numbers without using third variable using AND and OR operators

2 Answers  






In c programming typeing to occupy the variables in memory space. if not useing the variable the memory space is wasted.ok, how to avoid the situation..? (the variable is used & notused)

0 Answers   Wipro,


When is an interface "good"?

1 Answers  


#include<stdio.h> void main() { int a=10,b=20,c=30; printf("%d",scanf("%d%d%d",&a,&b,&c)); } what is the output for this?

4 Answers   IIIT,


A B C D E F G F E D C B A A B C D E F F E D C B A A B C D E E D C B A A B C D D C B A A B C C B A A B B A A A

2 Answers  


what is the output of the following program? #include<stdio.h> void main() { int x=4,y=3,z; z=x-- -y; printf("\n%d %d %d",x,y,z); }

14 Answers  


Write a Program to find whether the given number or string is palindrome.

0 Answers   InterGraph,


Why we use break in c?

0 Answers  


Categories