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
How can I dynamically allocate arrays?
what are the facialities provided by you after the selection of the student.
What are the disadvantages of external storage class?
How will you find a duplicate number in a array without negating the nos ?
Which is better between malloc and calloc?
The number of measuring units from an arbitarary starting point in a record,area,or control block to some other point a) recording pointer b) offset c) branching d) none
Hello. How to write a C program to check and display president party like if i type in the console "biden" and hit enter the output shoud be : "biden is democrat" and if i type "trump" and hit enter the output shoud be: "trump is republican"
pgm to find number of words starting with capital letters in a file(additional memory usage not allowed)(if a word starting with capital also next letter in word is capital cann't be counted twice)
How can I invoke another program or command and trap its output?
List a few unconditional control statement in c.
What is a char c?
Write a program to print numbers from 1 to 100 without using loop in c?
Can you assign a different address to an array tag?
What is double pointer?
What the advantages of using Unions?