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
What is wrong with this declaration?
Why can arithmetic operations not be performed on void pointers?
Why we write conio h in c?
Is there a way to have non-constant case labels (i.e. Ranges or arbitrary expressions)?
Do pointers take up memory?
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
what is a function method?give example?
Apart from dennis ritchie who the other person who contributed in design of c language.
A global variable when referred to in another file is declared as this a) local variable b) external variable c) constant d) pointers
What happens if you free a pointer twice?
What does 2n 4c mean?
Is c language still used?
Where register variables are stored in c?
What is zero based addressing?
Can we initialize extern variable in c?