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 / anu
the output wll be hello , since the argument is overwritten
with new memory in the function.
so in main, when it comes to printf, p points to the
allocatd memory, which contains hello
Is This Answer Correct ? | 0 Yes | 3 No |
Post New Answer View All Answers
What is c language & why it is used?
Explain the use of 'auto' keyword
Differentiate between functions getch() and getche().
What are the rules for the identifier?
How do I read the arrow keys? What about function keys?
What is const volatile variable in c?
Explain how do you declare an array that will hold more than 64kb of data?
Explain that why C is procedural?
Can variables be declared anywhere in c?
What is the general form of a C program?
What is the difference between text files and binary files?
How do you view the path?
any restrictions have on the number of 'return' statements that may be present in a function. a) no restriction b) only 2 return statements c) only 1 return statements d) none of the above
Can a pointer be volatile in c?
Write a program to check prime number in c programming?