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
Explain how can you be sure that a program follows the ansi c standard?
Explain the properties of union. What is the size of a union variable
What are disadvantages of C language.
List a few unconditional control statement in c.
Create a structure to specify data on students given below: Roll number, Name, Department, Course, Year of joining Assume that there are not more than 450 students in the college. 1.write a function to print names of all students who joined in a particular year 2.write a function to print the data of a student whose roll number is given
What are the 32 keywords in c?
When should volatile modifier be used?
Explain how can I make sure that my program is the only one accessing a file?
find the value of y y = 1.5x+3 for x<=2 y = 2x+5 for x>2
how to find anagram without using string functions using only loops in c programming
Which one to choose from 'initialization lists' or 'assignment', for the use in the constructor?
What is a list in c?
Does * p ++ increment p or what it points to?
What are enums in c?
What is function definition in c?