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

Write a program, where i have a grid with many cells, how many paths are possible from one point to other desired points.

672


What is c mainly used for?

573


How to write c functions that modify head pointer of a linked list?

522


Explain how are 16- and 32-bit numbers stored?

756


What is the use of header files?

577






What is the value of a[3] if integer a[] = {5,4,3,2,1}?

639


What is a good way to implement complex numbers in c?

571


What is #include in c?

574


‘SAVEPOINT’ and ‘ROLLBACK’ is used in oracle database to secure the data comment. Give suitable examples of each with sql command.

1857


Is it acceptable to declare/define a variable in a c header?

663


Without Computer networks, Computers will be half the use. Comment.

1844


a value that does not change during program execution a) variabe b) argument c) parameter d) none

669


Describe static function with its usage?

583


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

595


Why main is used in c?

560