f(char *p)
{
p=(char *)malloc(sizeof(6));
strcpy(p,"HELLO");
}
main()
{
char *p="BYE";
f(p)
printf("%s",p);
}
what is the output?
Answer Posted / vijay
The out put is "BYE".
Because the pointer p dies when function exit with out
return,in main pointer p points to only "BYE",so prinf
prints which p points in main.
Is This Answer Correct ? | 2 Yes | 1 No |
Post New Answer View All Answers
Explain pointers in c programming?
Can you add pointers together? Why would you?
What is size of union in c?
What are # preprocessor operator in c?
When should you use a type cast?
What are identifiers in c?
Which is best book for data structures in c?
Explain what are the advantages and disadvantages of a heap?
What are type modifiers in c?
Why is a semicolon (;) put at the end of every program statement?
Create a registration form application by taking the details like username, address, phone number, email with password and confirm password (should be same as password).Ensure that the password is of 8 characters with only numbers and alphabets. Take such details for 3 users and display the details. While taking input password must appear as “****”.
Is a house a mass structure?
can anyone please tell about the nested interrupts?
In which language linux is written?
What is wrong with this statement? Myname = 'robin';