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
How can I get back to the interactive keyboard if stdin is redirected?
Explain what are its uses in c programming?
What is modeling?
a program that can input number of records and can view it again the record
Differentiate call by value and call by reference?
PLS U SENS ME INTERVIEW O. MY EMAIL ADD, SOFIYA.SINGH@GMAIL.COM
In C programming, how do you insert quote characters (‘ and “) into the output screen?
What is c preprocessor mean?
program to find error in linklist.(i.e find whether any node point wrongly to previous nodes instead of next node)
What is an auto variable in c?
What are global variables and how do you declare them?
what are bit fields in c?
code for find determinent of amatrix
Explain can static variables be declared in a header file?
What is the difference between exit() and _exit() function?