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
What are the 32 keywords in c?
How do you initialize pointer variables?
What are examples of structures?
Given two strings S1 and S2. Delete from S2 all those characters which occur in S1 also and finally create a clean S2 with the relevant characters deleted.
Why main function is special give two reasons?
What is meant by type specifiers?
Explain union. What are its advantages?
What is difference between class and structure?
What is a pointer in c plus plus?
Is javascript based on c?
Explain how do you sort filenames in a directory?
What is a #include preprocessor?
please give me some tips for the placement in the TCS.
What are external variables in c?
A program is required to print your biographic information including: Names, gender, student Number, Cell Number, line of study and your residential address.