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

Given a single Linked list with lakhs of nodes and length unknown how do you optimally delete the nth element from the list?

1 Answers   Oracle,


The C language terminator is a.semicolon b.colon c.period d.exclamation mark

6 Answers   TCS,


compute the nth mumber in the fibonacci sequence?

10 Answers   Canon, HPL, Satyam, TCS,


Write a client and server program in C language using UDP, where client program interact with the Server as given below: i) The client begins by sending a request to send a string of 8 characters or series of 7 numbers, the server sends back a characters or numbers as per the request of the client. ii) In case of series of 7 numbers: The client sends a multiplication of numbers, to the server. iii) In case of a string of 8 characters: The client sends a reverse order of string to the server.. iv) Server will send an acknowledgment to the client after receiving the correct answer

0 Answers   Ignou, Microsoft,


please give me some tips for the placement in the TCS.

0 Answers   TCS,






What is the newline escape sequence?

0 Answers  


What is optimization in c?

0 Answers  


What is the purpose of the following code? Is there any problem with the code? void send(int count, short *to, short *from) { /* count > 0 assumed */ register n = (count + 7) / 8; switch (count % 8) { case 0: do { *to = *from++; case 7: *to = *from++; case 6: *to = *from++; case 5: *to = *from++; case 4: *to = *from++; case 3: *to = *from++; case 2: *to = *from++; case 1: *to = *from++; } while (--n > 0); } }

0 Answers   Google,


What is exit() function?

0 Answers  


WHAT IS HIGH LEVEL LANGUAGE?

2 Answers  


why in C,C++'s int size is 2 byte and .net(c#) int Size is 4 byte?

2 Answers  


what is difference between #include<stdio.h> and #include"stdio.h"

4 Answers  


Categories