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


Please Help Members By Posting Answers For Below Questions

What is the meaning of && in c?

782


the 'sizeof' operator reported a larger size than the calculated size for a structure type. What could be the reason?

776


What is the description for syntax errors?

872


What are the 5 elements of structure?

846


"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

912


What are the 5 types of inheritance in c ++?

793


What is the process to create increment and decrement stamen in c?

828


A collection of functions,calls,subroutines or other data a) library b) header files c) set of files d) textfiles

946


What does dm mean sexually?

1082


What is the difference between formatted&unformatted i/o functions?

850


What is the benefit of using an enum rather than a #define constant?

969


What is structure padding and packing in c?

839


How can I check whether a file exists? I want to warn the user if a requested input file is missing.

930


Write program to remove duplicate in an array?

848


Explain what is the benefit of using #define to declare a constant?

839