读书人

趋势科技几道笔考题

发布时间: 2013-03-28 10:20:24 作者: rapoo

趋势科技几道笔试题

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);}

a) The string is :String

b)Run time error/Core dump

c)The string is :Oldstring

d)Sysntax error during complication

3) None of these

读书人网 >编程

热点推荐