what wud be the output?

main()
{
char *str[]={
"MANISH"
"KUMAR"
"CHOUDHARY"
};
printf("\nstring1=%s",str[0]);
printf("\nstring2=%s",str[1]);
printf("\nstring3=%s",str[2]);

a)string1=Manish
string2=Kumar
string3=Choudhary

b)string1=Manish
string2=Manish
string3=Manish

c)string1=Manish Kumar Choudhary
string2=(null)
string3=(null)

d)Compiler error





Answer Posted / rakesh soni

c)string1=Manish Kumar Choudhary
string2=(null)
string3=(null)

Bcoz, at the time of initialization, we are giving "mainsh"
"kumar" "choudhary", which is not comma seprated. so "Manish
kumar choudhary" string goes on to 0 position of the array
of char pointer. rest of 2 string have null.

Is This Answer Correct ?    11 Yes 1 No



Post New Answer       View All Answers


Please Help Members By Posting Answers For Below Questions

Tell me when would you use a pointer to a function?

607


What are unions in c?

580


Why do we use namespace feature?

583


Explain modulus operator.

597


How can I write functions that take a variable number of arguments?

626






What does the message "automatic aggregate intialization is an ansi feature" mean?

694


What is string function in c?

540


What is getch?

633


How can I avoid the abort, retry, fail messages?

661


Give a one-line C expression to test whether a number is a power of 2. [No loops allowed - it's a simple test.]

632


What are the disadvantages of c language?

622


What is masking?

637


How to set file pointer to beginning c?

667


Difference between constant pointer and pointer to a constant.

613


can any one please explain, how can i access hard disk(physical address)? it is possible by the use of far,near or huge pointer? if yes then please explain......

1411