Answer Posted / shruti
the syntax of malloc is wrong.
in your example it should be written as:
char *p;
p = (char *)malloc(sizeof(char));
Is This Answer Correct ? | 21 Yes | 1 No |
Post New Answer View All Answers
how do you write a function that takes a variable number of arguments? What is the prototype of printf () function?
What is meant by errors and debugging?
regarding pointers concept
What is the use of f in c?
What is switch in c?
Write an algorithm for implementing insertion and deletion operations in a singly linked list using arrays ?
Is using exit() the same as using return?
What is a ternary operator in c?
Why static variable is used in c?
how to execute a program using if else condition and the output should enter number and the number is odd only...
Compare and contrast compilers from interpreters.
Explain how can a program be made to print the name of a source file where an error occurs?
Who developed c language and when?
What are loops in c?
main() { struct s1 { char *str; struct s1 *ptr; }; static struct s1 arr[] = { {"Hyderabad",arr+1}, {"Bangalore",arr+2}, {"Delhi",arr} }; struct s1 *p[3]; int i; < BR> for(i=0;i<=2;i++) p[i] = arr[i].ptr; printf("%s ",(*p)->str); printf("%s ",(++*p)->str); printf("%s ",((*p)++)->str); }