f(*p)
{
p=(char *)malloc(6);
p="hello";
return;
}
main()
{
char *p="bye";
f(p);
printf("%s",p);
}
what is the o/p?

Answers were Sorted based on User's Feedback



f(*p) { p=(char *)malloc(6); p="hello"; return; } main() { ..

Answer / fazlur rahaman naik

actually the above programme produces an error.because u've
to mention which type of pointer it is at fuction f(*p).
i.e f(char *p).
if u correct this error.then the out put will be
bye

Is This Answer Correct ?    4 Yes 1 No

f(*p) { p=(char *)malloc(6); p="hello"; return; } main() { ..

Answer / yellareddy

After removing the error, the output is "bye"

Is This Answer Correct ?    0 Yes 0 No

f(*p) { p=(char *)malloc(6); p="hello"; return; } main() { ..

Answer / subbu

after correction of error, the output will be hello

Is This Answer Correct ?    1 Yes 2 No

f(*p) { p=(char *)malloc(6); p="hello"; return; } main() { ..

Answer / vrushali

The answer is bye...

Is This Answer Correct ?    1 Yes 2 No

f(*p) { p=(char *)malloc(6); p="hello"; return; } main() { ..

Answer / hussain reddy

hello

Is This Answer Correct ?    0 Yes 1 No

f(*p) { p=(char *)malloc(6); p="hello"; return; } main() { ..

Answer / madhureddy

the answer is bye

Is This Answer Correct ?    0 Yes 1 No

f(*p) { p=(char *)malloc(6); p="hello"; return; } main() { ..

Answer / vignesh1988i

bye

Is This Answer Correct ?    0 Yes 2 No

Post New Answer

More C Interview Questions

How can I make it pause before closing the program output window?

0 Answers  


Will Macros support multiple arguments ?

7 Answers   Oracle,


Differentiate fundamental data types and derived data types in C.

0 Answers   HCL,


we called a function and passed something do it we have always passed the "values" of variables to the called function. such functions calles are called a) calls by reference b) calls by value c) calls by zero d) none of the above

0 Answers  


There is a number and when the last digit is moved to its first position the resultant number will be 50% higher than the original number.Find the number?

1 Answers  






write a program which the o/p should b in such a way that s triangle if I/p is 3,a Square/rectangle if I/P=4,a pentagon if I/P=5 and so on...forget about the I/P which is less than 3

0 Answers   ADP,


What is the difference between union and anonymous union?

0 Answers   Hexaware,


How to swap two values using a single variable ? condition: Not to use Array and Pointer ?

6 Answers  


Write a program to enter the name and age. If age>28 then find salary categories. if age<28 then find that you are gaduate or not.

1 Answers  


The operation of a stair case switch best explains the a) or operation b) and operation c)exclusive nor operation d)exclusive or operation Which of the following is/are syntactically correct? a) for(); b) for(;); c) for(,); d) for(;;);

1 Answers   HCL, Public Service Commission,


What is the Purpose of 'extern' keyword in a function declaration?

0 Answers  


What is a macro?

0 Answers  


Categories