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
Write a program, where i have a grid with many cells, how many paths are possible from one point to other desired points.
What is c mainly used for?
How to write c functions that modify head pointer of a linked list?
Explain how are 16- and 32-bit numbers stored?
What is the use of header files?
What is the value of a[3] if integer a[] = {5,4,3,2,1}?
What is a good way to implement complex numbers in c?
What is #include in c?
‘SAVEPOINT’ and ‘ROLLBACK’ is used in oracle database to secure the data comment. Give suitable examples of each with sql command.
Is it acceptable to declare/define a variable in a c header?
Without Computer networks, Computers will be half the use. Comment.
a value that does not change during program execution a) variabe b) argument c) parameter d) none
Describe static function with its usage?
What is the difference between formatted&unformatted i/o functions?
Why main is used in c?