Answer Posted / guest
malloc returns a void pointer. It needs to be cast to char*
before allocating it to char* variable.
char *p = (char *)malloc(10); should do fine.
| Is This Answer Correct ? | 26 Yes | 2 No |
Post New Answer View All Answers
Explain what is a stream?
write a program in C that prompts the user for today's date,tomorrow's date and display the results.Use structures for today's date,tomorrow's date and an array to hold the days for each month of the year.
What is wild pointer in c?
What is 2c dna?
Why is it usually a bad idea to use gets()? Suggest a workaround.
What is variable and explain rules to declare variable in c?
What is formal argument?
What is an example of structure?
What are extern variables in c?
Do you know the use of 'auto' keyword?
What is the use of getch ()?
What is a volatile keyword in c?
#include main() { char s[] = "Bouquets and Brickbats"; printf(" %c, ",*(&s[2])); printf("%s, ",s+5); printf(" %s",s); printf(" %c",*(s+2)); }
What is the correct declaration of main?
What is difference between structure and union in c?