首页 > 考试题库
题目内容 (请给出正确答案)
[主观题]

试题2: void test2(){ char string[10], str1[10]; int i; for(i=0; i<10; i++) { str1[i] =

试题2:

void test2()

{

char string[10], str1[10];

int i;

for(i=0; i<10; i++)

{

str1[i] = 'a';

}

strcpy(string, str1 );

}

查看答案
答案
收藏
如果结果不匹配,请 联系老师 获取答案
您可能会需要:
您的账号:,可能还需要:
您的账号:
发送账号密码至手机
发送
安装优题宝APP,拍照搜题省时又省心!
更多“试题2: void test2(){ char string…”相关的问题
第1题
试题2:void test2(){char string[10], str1[10];int i;for(i=0; i<10; i++){str1 = 'a';}strc

试题2:

void test2()

{

char string[10], str1[10];

int i;

for(i=0; i<10; i++)

{

str1 = 'a';

}

strcpy(string, str1 );

}

点击查看答案
第2题
下面代码有什么问题?Void test2(){char string[10], str1[10];for(i=0; i<10;i++){str1[i]

下面代码有什么问题?

Void test2()

{

char string[10], str1[10];

for(i=0; i<10;i++)

{

str1[i] ='a';

}

strcpy(string, str1);

}

点击查看答案
第3题
找错Void test1(){char string[10];char* str1="0123456789";strcpy(string, str1);}Void tes

找错

Void test1()

{

char string[10];

char* str1="0123456789";

strcpy(string, str1);

}

Void test2()

{

char string[10], str1[10];

for(I=0; I<10;I++)

{

str1[i] ='a';

}

strcpy(string, str1);

}

Void test3(char* str1)

{

char string[10];

if(strlen(str1)<=10)

{

strcpy(string, str1);

}

}

点击查看答案
第4题
写出以下程序的运行结果。public class Test2 {public static void main(String args[ ]){int i,j

写出以下程序的运行结果。public class Test2 {public static void main(String args[ ]){int i,j;int a[]={17,91,65,35,28};for (i = 0; i < a.length-1; i++ ) {int k = i;for(j = i; j < a.length; j++ )if (a[j]>a[k] )k = j;int temp =a[i];a[i] = a[k];a[k] = temp;}for (i =0; i<a.length; i++ )System.out.print(a[i]+" ");System.out.println();} }

点击查看答案
第5题
试题2:以下为Windows NT下的32位C++程序,请计算sizeof的值 void Func (char str[100] ){ size

试题2:以下为Windows NT下的32位C++程序,请计算sizeof的值 void Func (char str[100] )

{

sizeof(str ) = ?

}

void *p = malloc(100 );

sizeof (p ) = ?

点击查看答案
第6题
试题2:以下为Windows NT 下的32 位C++程序,请计算sizeof的值void Func (char str[100] ){sizeof

试题2:以下为Windows NT 下的32 位C++

程序,请计算sizeof的值

void Func (char str[100] )

{

sizeof(str ) = ?

}

void *p = malloc(100 );

sizeof (p ) = ?

点击查看答案
第7题
试题5:编写一个函数,作用是把一个char组成的字符串循环右移n个。比如原来是“abcdefghi”如果n=2,移
位后应该是“hiabcdefgh”

函数头是这样的:

//pStr是指向以'\0'结尾的字符串的指针

//steps是要求移动的n

void LoopMove (char * pStr, int steps )

{

//请填充...

}

点击查看答案
第8题
试题5:编写一个函数,作用是把一个char组成的字符串循环右移n 个。比如原来是"abcdefghi"如果n=2,

试题5:编写一个函数,作用是把一个char组

成的字符串循环右移n 个。比如原来是"abcdefghi"

如果n=2,移位后应该是"hiabcdefgh"

函数头是这样的:

//pStr是指向以'\0'结尾的字符串的指针

//steps是要求移动的n

void LoopMove (char * pStr, int steps )

{

//请填充...

}

点击查看答案
第9题
试题6:void GetMemory(char **p, int num ){*p = (char *) malloc(num );}void Test(void ){c

试题6:

void GetMemory(char **p, int num )

{

*p = (char *) malloc(num );

}

void Test(void )

{

char *str = NULL;

GetMemory(&str, 100 );

strcpy(str, "hello" );

printf(str );

点击查看答案
第10题
试题7: void Test(void ){ char *str = (char *) malloc(100 ); strcpy(str, "hello" ); free

试题7:

void Test(void )

{

char *str = (char *) malloc(100 );

strcpy(str, "hello" );

free(str );

... //省略的其它语句

}

点击查看答案
退出 登录/注册
发送账号至手机
密码将被重置
获取验证码
发送
温馨提示
该问题答案仅针对搜题卡用户开放,请点击购买搜题卡。
马上购买搜题卡
我已购买搜题卡, 登录账号 继续查看答案
重置密码
确认修改