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
When reallocating memory if any other pointers point into the same piece of memory do you have to readjust these other pointers or do they get readjusted automatically?
What is the total generic pointer type?
main() { printf("hello"); fork(); }
Tell me about low level programming languages.
What is sizeof c?
Who invented b language?
What is a stream in c programming?
In c programming write a program that will print 10 multiples of 3 except 15,18,21 using looping
How can I call fortran?
Why & is used in scanf in c?
What are the disadvantages of external storage class?
why wipro wase
What is a null pointer assignment error? What are bus errors, memory faults, and core dumps?
What is extern c used for?
Why is main function so important?