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 / deepa
the outpu is hello coz the pointer is pointing to a
location where the string "bye" is written in the next
program yu are using the same pointer to point to some
other string so it gets overwritten
| Is This Answer Correct ? | 2 Yes | 5 No |
Post New Answer View All Answers
Explain how do you sort filenames in a directory?
What are nested functions in c?
What are void pointers in c?
explain what are actual arguments?
which of the following is allowed in a "C" arithematic instruction a) [] b) {} c) () d) none of the above
What is wrong with this statement? Myname = 'robin';
How can I ensure that integer arithmetic doesnt overflow?
How to check whether string is a palindrome, WITHOUT USING STRING FUNCTIONS?
What is a keyword?
Why we use conio h in c?
What does the message "automatic aggregate intialization is an ansi feature" mean?
What do you know about the use of bit field?
What does c mean?
Why static is used in c?
What are volatile variables in c?