main()
{
char *p1="Name";
char *p2;
p2=(char *)malloc(20);
while(*p2++=*p1++);
printf("%s\n",p2);
}
Answer Posted / vignesh1988i
actually in this problem, the p2 will take characters after '\0' too from p1 upto the size of p2 come to an end.
so it prints
output :
Name #^$&dhd
thank u
| Is This Answer Correct ? | 1 Yes | 1 No |
Post New Answer View All Answers
Why is c called "mother" language?
Why should I prototype a function?
What is the total generic pointer type?
What are compound statements?
count = 0; for (i = 1;i < = 10; i++);count = count + i; Value of count after execution of the above statements will be a) 0 b) 11 c) 55 d) array
Describe the modifier in c?
What is stack in c?
.main() { char *p = "hello world!"; p[0] = 'H'; printf("%s",p); }
Explain what is the difference between text files and binary files?
What is a null string in c?
Explain the use of 'auto' keyword in c programming?
How many types of functions are there in c?
stripos — Find position of first occurrence of a case- insensitive string int stripos ( char* haystack, char* needle, int offset ) Returns the numeric position of the first occurrence of needle in the haystack string. Note that the needle may be a string of one or more characters. If needle is not found, stripos() will return -1. The function should not make use of any C library function calls.
Explain which function in c can be used to append a string to another string?
What is floating point constants?