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 is the meaning of && in c?
the 'sizeof' operator reported a larger size than the calculated size for a structure type. What could be the reason?
What is the description for syntax errors?
What are the 5 elements of structure?
"C" language developed by "Dennis Ritchie" at AT & T. his remarks are a) too general, too abstract b) could deal with only specific problems c) lost generality of BCPL and B restored d) no remarks
What are the 5 types of inheritance in c ++?
What is the process to create increment and decrement stamen in c?
A collection of functions,calls,subroutines or other data a) library b) header files c) set of files d) textfiles
What does dm mean sexually?
What is the difference between formatted&unformatted i/o functions?
What is the benefit of using an enum rather than a #define constant?
What is structure padding and packing in c?
How can I check whether a file exists? I want to warn the user if a requested input file is missing.
Write program to remove duplicate in an array?
Explain what is the benefit of using #define to declare a constant?