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 does c mean before a date?
Explain how can I convert a string to a number?
What are the different types of linkage exist in c?
What header files do I need in order to define the standard library functions I use?
What is pragma in c?
Is main a keyword in c?
What are the types of pointers in c?
Where static variables are stored in c?
What was noalias and what ever happened to it?
a c code by using memory allocation for add ,multiply of sprase matrixes
Is c a great language, or what?
Explain output of printf("Hello World"-'A'+'B'); ?
Write a program to generate a pulse width frequency of your choise,which can be variable by using the digital port of your processor
What are structures and unions? State differencves between them.
please give me some tips for the placement in the TCS.