What will be result of the following program?
void myalloc(char *x, int n)
{
x= (char *)malloc(n*sizeof(char));
memset(x,\0,n*sizeof(char));
}
main()
{
char *g="String";
myalloc(g,20);
strcpy(g,"Oldstring");
printf("The string is %s",g);
}
a) The string is : String
b) Run time error/Core dump
c) The string is : Oldstring
d) Syntax error during compilation
e) None of these
Answer Posted / v.prasad
a)the string is string
| Is This Answer Correct ? | 0 Yes | 1 No |
Post New Answer View All Answers
a program that can input number of records and can view it again the record
What is the package for freshers(Non IIT) in amazon(hyderabad). And what is the same for those who are a contract employee.
What is the general form of a C program?
What are the different types of constants?
What is the meaning of && in c?
What are the application of c?
Is null a keyword in c?
Why is c not oop?
Function which gives a pointer to a binary trees const an integer value at each code, return function of all the nodes in binary tree.?
Are pointers integer?
What are the advantages of c preprocessor?
How can I call fortran?
What are bitwise shift operators in c programming?
Write a program to print fibonacci series without using recursion?
What are the loops in c?