main()
{
char *p1="Name";
char *p2;
p2=(char *)malloc(20);
while(*p2++=*p1++);
printf("%s\n",p2);
}
Answer Posted / subbu[iit kgp]
the given program gives some meaningless output, with some
modification to the given program as
#include<stdio.h>
#include<stdlib.h>
main()
{
char a[]="ramesh";
char *p1="Name";
char *p2=a;
while(*p2++=*p1++);/*copies contents of p1 to
p2*//* here it is not possible to use while(*a++=*p1++)
because a can not change its value*/
*p2='\0';
printf("%s\n",a);
}
The output will be Name
| Is This Answer Correct ? | 2 Yes | 1 No |
Post New Answer View All Answers
design and implement a data structure and performs the following operation with the help of file (included 1000 student marks in 5 sub. and %also) 1.how many students are fail in all 5 subjects (if >35) 2. delete all student data those are fail in all 5 subjects. 3. update the grace marks (5 no. if exam paper is 100 marks) 4. arrange the student data in ascending order basis of marks. 5.insert double of deleted students with marks in the list.
Are the expressions * ptr ++ and ++ * ptr same?
How can you determine the maximum value that a numeric variable can hold?
Synonymous with pointer array a) character array b) ragged array c) multiple array d) none
Write a program to generate random numbers in c?
Explain can the sizeof operator be used to tell the size of an array passed to a function?
What are called c variables?
How do I determine whether a character is numeric, alphabetic, and so on?
What is difference between stdio h and conio h?
What is LINKED LIST? How can you access the last element in a linked list?
Is there a way to compare two structure variables?
Explain what is output redirection?
What is hashing in c language?
What is the method to save data in stack data structure type?
Can the curly brackets { } be used to enclose a single line of code?