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
Do pointers need to be initialized?
How can you tell whether two strings are the same?
Which is best linux os?
Give me the code of in-order recursive and non-recursive.
What is meant by realloc()?
Why do we need a structure?
What are the usage of pointer in c?
What are the main characteristics of c language describe the structure of ac program?
What are the types of assignment statements?
Please send me WIPRO technical question to my mail ID.. its nisha_g28@yahoo.com please its urgent
Explain modulus operator. What are the restrictions of a modulus operator?
What is self-referential structure in c programming?
Are there any problems with performing mathematical operations on different variable types?
What is ## preprocessor operator in c?
Explain what are the different data types in c?