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
What are multidimensional arrays?
What is typedf?
How can I get random integers in a certain range?
Explain what are header files and explain what are its uses in c programming?
how could explain about job profile
What is a nested loop?
What is modifier & how many types of modifiers available in c?
Explain how do you override a defined macro?
Can we declare a function inside a function in c?
What is actual argument?
What is pointer and structure in c?
What are the different properties of variable number of arguments?
What is keyword in c?
What is c programming structure?
Discuss the function of conditional operator, size of operator and comma operator with examples.