参考代码如下:
char *f(int n){ char *s=(char *)malloc((n+1)*sizeof(char)); int i; for(i=0;i s[i]='1'; s[i]=0; return s;}