下面函数的作用是以双倍行距输出文件:
void test(ifstream&outf,ofstream&outC) {
char c;
while(______){
______;
if(c=='\n')outc.put(C) ;
}
}
下划线处缺失的代码是( )。
A.outf.put(C) 与outc.get(C)
B.outf.put(C) 与outc.get(C)
C.outf.get(C) 与outc.put?
D.outf.get(C) 与outc.put?
第1题:
char *GetMemory(void){ char p[] = "hello world";return
p; }void Test(void){char *str = NULL;str = GetMemory(); printf(str);}请问运行 Tes
t 函数会有什么样的结果?
第2题:
void Test(void){char *str = (char *)
malloc(100); strcpy(str, “hello”); free(str); if(str != NULL) { strcpy(str, “
world”); printf(str);}}请问运行 Test 函数会有什么样的结果?
第3题:
下面的程序执行后,文件test中的内容是 void fun(char *fname, char *st) { FILE *myf; int i; myf=fopen (fname, "w"); for(i=0; i<strlen(st); i++) fputc(st[i], myf); fclose(myf); } int main(void){ fun("test", "new world"); fun("test", "hello,"); return 0; }
A.new worldhello,
B.hello,
C.new world
D.hello,rld
第4题:
Void GetMemory2(char **p, int num){*p = (char *)malloc(num);}void
Test(void){char *str = NULL;GetMemory(&str, 100);strcpy(str, "hello"); printf(str); }请问
运行Test 函数会有什么样的结果?
第5题:
设有以下函数:
voidfun(intn,char}s){……}
则下面对函数指针的定义和赋值均正确的是( )。
A.void(*pf)(int,char);pf=&fun;
B.void+pf( );pf=fun;
C.void*pf( );*pf=fun;
D.void(*pf)(int,char*);pf=fun;