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
Tell me when would you use a pointer to a function?
What are unions in c?
Why do we use namespace feature?
Explain modulus operator.
How can I write functions that take a variable number of arguments?
What does the message "automatic aggregate intialization is an ansi feature" mean?
What is string function in c?
What is getch?
How can I avoid the abort, retry, fail messages?
Give a one-line C expression to test whether a number is a power of 2. [No loops allowed - it's a simple test.]
What are the disadvantages of c language?
What is masking?
How to set file pointer to beginning c?
Difference between constant pointer and pointer to a constant.
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......