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 quick sort in c?
Explain the priority queues?
When we use void main and int main?
Can we access the array using a pointer in c language?
Difference between Function to pointer and pointer to function
How to set file pointer to beginning c?
Write a client and server program in C language using UDP, where client program interact with the Server as given below: i) The client begins by sending a request to send a string of 8 characters or series of 7 numbers, the server sends back a characters or numbers as per the request of the client. ii) In case of series of 7 numbers: The client sends a multiplication of numbers, to the server. iii) In case of a string of 8 characters: The client sends a reverse order of string to the server.. iv) Server will send an acknowledgment to the client after receiving the correct answer
write a c program thal will find all sequences of length N that produce the sum is Zero, print all possible solutions?
Explain what is a program flowchart and explain how does it help in writing a program?
What is the value of uninitialized variable in c?
What is const keyword in c?
GIven a sequence of characters. How will you convert the lower case characters to upper case characters. ( Try using bit vector - sol given in the C lib -> typec.h)
write a C program: To recognize date of any format even formats like "feb-02-2003","02-february-2003",mm/dd/yy, dd/mm/yy and display it as mm/dd/yy.
Define recursion in c.
Mention four important string handling functions in c languages .