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
Post New Answer View All Answers
What language is windows 1.0 written?
struct screen_pos{ int row, col } ;move_right(cursor)struct screen_pos *cursor;{ cursor.col++; } /* This statementhas a syntax error */What is the correct statement a) cursor.col = cursor.col + 1; b) col.cursor++; c) *cursor.col++; d) pointer
What is void c?
which type of aspect you want from the student.
What is 02d in c?
Can we add pointers together?
Tell us two differences between new () and malloc ()?
What are linker error?
Explain how do I determine whether a character is numeric, alphabetic, and so on?
An expression to whose value an operater is applied a) operand b) variable c) constant d) all of the above
What is the difference between c &c++?
How to check whether string is a palindrome, WITHOUT USING STRING FUNCTIONS?
Is swift based on c?
Does * p ++ increment p or what it points to?
i = 25;switch (i) {case 25: printf("The value is 25 ");case 30: printf("The value is 30 "); When the above statements are executed the output will be : a) The value is 25 b) The value is 30 c) The value is 25 The value is 30 d) none