趋势科技几道笔试题
1. What is the output of the following program?
#include<iostream>using namespace std;void myalloc(char *x,int n){x=(char*)malloc(n*sizeof(char));memset(x,0,n*sizeof(char));}int main(){char *g="String";myalloc(g,20);strcpy(g,"Oldstring");printf("The string is %s",g);}b)Run time error/Core dump
c)The string is :Oldstring
d)Sysntax error during complication
3) None of these