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


Please Help Members By Posting Answers For Below Questions

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

1446


Can you define which header file to include at compile time?

601


What is a floating point in c?

614


Is c is a procedural language?

607


What is a double c?

601






What are the types of pointers in c?

542


Explain what are compound statements?

614


if a is an integer variable, a=5/2; will return a value a) 2.5 b) 3 c) 2 d) 0

1463


If I have a char * variable pointing to the name of a function ..

666


In C programming, what command or code can be used to determine if a number of odd or even?

632


Why void main is used in c?

568


any C program contains only one function, it must be a) void () b) main () c) message () d) abc ()

703


What is a spanning Tree?

973


List some of the dynamic data structures in C?

798


What is wrong with this statement? Myname = 'robin';

832