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 / vijay

The out put is "BYE".
Because the pointer p dies when function exit with out
return,in main pointer p points to only "BYE",so prinf
prints which p points in main.

Is This Answer Correct ?    2 Yes 1 No



Post New Answer       View All Answers


Please Help Members By Posting Answers For Below Questions

What is wrong with this declaration?

606


Why can arithmetic operations not be performed on void pointers?

583


Why we write conio h in c?

557


Is there a way to have non-constant case labels (i.e. Ranges or arbitrary expressions)?

574


Do pointers take up memory?

650






1) write a program to generate 1st n fibonacci prime numbers using Nested if 2) write a program to generate twin prime numbers from m to n using nested if 3) write a program to check whether a given integer is a strong number or not using nested if 4) Write a program to generate prime factors of a given integer using nested if 5)write a program to generate prime numbers from m to n using nested if 6)write a program to generate perfect numbers from m to n using nested if 7)write a program to generate the pallindromes from m to n using neste if 8)write a program to generate armstrong numbers from m to n using nested if 9)write a program to generate strong numbers from m to n using nested if

3975


what is a function method?give example?

1910


Apart from dennis ritchie who the other person who contributed in design of c language.

801


A global variable when referred to in another file is declared as this a) local variable b) external variable c) constant d) pointers

647


What happens if you free a pointer twice?

604


What does 2n 4c mean?

708


Is c language still used?

533


Where register variables are stored in c?

541


What is zero based addressing?

705


Can we initialize extern variable in c?

626