Answer Posted / poornima
Nothing wrong.Its fine..
if u hve further doubt run the below code.
#include<stdio.h>
int main()
{
char *p=malloc(10);
if(p==NULL)
{
printf("malloc failed");
exit(0);
}
else
{
printf("malloc success\n");
p="hai";
printf("%s",p);
}
return 0;
}
o/p:
malloc success
hai
| Is This Answer Correct ? | 6 Yes | 10 No |
Post New Answer View All Answers
#include
Why do we use header files in c?
If a five digit number is input through the keyboard, write a program to print a new number by adding one to each of its digits.For example if the number that is input is 12391 then the output should be displayed as 23402
Explain how do you generate random numbers in c?
What is header file in c?
What are comments and how do you insert it in a C program?
In c programming typeing to occupy the variables in memory space. if not useing the variable the memory space is wasted.ok, how to avoid the situation..? (the variable is used & notused)
What is #include stdio h and #include conio h?
Why are some ANSI/ISO Standard library routines showing up as undefined, even though I've got an ANSI compiler?
What is structure data type in c?
What do the functions atoi(), itoa() and gcvt() do?
What oops means?
Can we assign string to char pointer?
Differentiate between functions getch() and getche().
Why is it that not all header files are declared in every C program?