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
Can we declare variable anywhere in c?
What are the different types of control structures in programming?
Why do we need arrays in c?
What is wrong in this statement? scanf(ā%dā,whatnumber);
Is c object oriented?
Explain what are reserved words?
How can I call system when parameters (filenames, etc.) Of the executed command arent known until run time?
Explain what is a pragma?
What is the Purpose of 'extern' keyword in a function declaration?
What is #include cctype?
What kind of structure is a house?
which of the following is allowed in a "C" arithematic instruction a) [] b) {} c) () d) none of the above
Why does notstrcat(string, "!");Work?
Explain why C language is procedural?
What is #define in c?