试题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 );
}
试题2:
void test2()
{
char string[10], str1[10];
int i;
for(i=0; i<10; i++)
{
str1[i] = 'a';
}
strcpy(string, str1 );
}
试题2:
void test2()
{
char string[10], str1[10];
int i;
for(i=0; i<10; i++)
{
str1 = 'a';
}
strcpy(string, str1 );
}
下面代码有什么问题?
Void test2()
{
char string[10], str1[10];
for(i=0; i<10;i++)
{
str1[i] ='a';
}
strcpy(string, str1);
}
找错
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);
}
}
写出以下程序的运行结果。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();} }
试题2:以下为Windows NT下的32位C++程序,请计算sizeof的值 void Func (char str[100] )
{
sizeof(str ) = ?
}
void *p = malloc(100 );
sizeof (p ) = ?
试题2:以下为Windows NT 下的32 位C++
程序,请计算sizeof的值
void Func (char str[100] )
{
sizeof(str ) = ?
}
void *p = malloc(100 );
sizeof (p ) = ?
函数头是这样的:
//pStr是指向以'\0'结尾的字符串的指针
//steps是要求移动的n
void LoopMove (char * pStr, int steps )
{
//请填充...
}
试题5:编写一个函数,作用是把一个char组
成的字符串循环右移n 个。比如原来是"abcdefghi"
如果n=2,移位后应该是"hiabcdefgh"
函数头是这样的:
//pStr是指向以'\0'结尾的字符串的指针
//steps是要求移动的n
void LoopMove (char * pStr, int steps )
{
//请填充...
}
试题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 );
试题7:
void Test(void )
{
char *str = (char *) malloc(100 );
strcpy(str, "hello" );
free(str );
... //省略的其它语句
}