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 the restrictions of a modulus operator?
What is quick sort in c?
write a c program thal will find all sequences of length N that produce the sum is Zero, print all possible solutions?
What is the difference between ++a and a++?
What is echo in c programming?
Differentiate between declaring a variable and defining a variable?
Explain what is the concatenation operator?
What are the preprocessor categories?
Explain the advantages and disadvantages of macros.
What is a node in c?
Which is better oop or procedural?
Can you explain what keyboard debouncing is, and where and why we us it? please give some examples
What is the size of structure pointer in c?
Can main () be called recursively?
find the sum of two matrices and WAP for it.