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
what is the c source code for the below output? 10 10 10 10 10 10 10 10 10 10 9 9 7 6 6 6 6 6 6 9 7 5 9 7 3 2 2 5 9 7 3 1 5 9 7 3 5 9 7 4 4 4 4 5 9 7 8 8 8 8 8 8 8 8 9
Can you define which header file to include at compile time?
What is a floating point in c?
Is c is a procedural language?
What is a double c?
What are the types of pointers in c?
Explain what are compound statements?
if a is an integer variable, a=5/2; will return a value a) 2.5 b) 3 c) 2 d) 0
If I have a char * variable pointing to the name of a function ..
In C programming, what command or code can be used to determine if a number of odd or even?
Why void main is used in c?
any C program contains only one function, it must be a) void () b) main () c) message () d) abc ()
What is a spanning Tree?
List some of the dynamic data structures in C?
What is wrong with this statement? Myname = 'robin';