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 what is gets() function?
how to find binary of number?
Tell us the use of fflush() function in c language?
Why c is called a mid level programming language?
What is the difference between a free-standing and a hosted environment?
Sir,please help me out with the code of this question. Write an interactive C program that will encode or decode multiple lines of text. Store the encoded text within a data file, so that it can be retrieved and decoded at any time. The program should include the following features: (a) Enter text from the keyboard, encode the text and store the encoded text in a data file. (b) Retrieve the encoded text and display it in its encoded form. (c) Retrieve the encoded text, decode it and then display the decoded text. (d) End the computation. Test the program using several lines of text of your choice.
How do you generate random numbers in C?
Why pointers are used in c?
How do I get an accurate error status return from system on ms-dos?
What are 3 types of structures?
which of the following shows the correct hierarchy of arithmetic operations in C a) (), **, * or/,+ or - b) (),**,*,/,+,- c) (),**,/,*,+,- d) (),/ or *,- or +
What is property type c?
Explain what is the benefit of using enum to declare a constant?
What is the difference between break and continue?
Explain what standard functions are available to manipulate strings?