相关题目
下面函数的功能是( )
int fun( char * x )
{
char *y = x;
while ( *y++ ) ;
return ( y - x - 1 );
}
下面程序的输出结果是( )
# include
# include
void main( void )
{
char *pstr1 = "abc";
char *pstr2 = "ABC";
char str[50] = "xyz";
strcpy( str + 2 , strcat( pstr1, pstr2 ) ) ;
printf( "%s\n", str ) ;
}
表达式 3. 6 - 5 / 2 + 1. 2 + 5 % 2 的值是( )
设有如下函数定义:
int fun( char *s )
{
char *p = s;
while ( *p != ' \0' )
{
p++;
}
return ( p - s ) ;
}
如果在主程序中用下面的语句调用上述函数, 则输出结果为( )
printf( "%d\n", fun( "goodbye!") ) ;
以下关于 while() 循环说法正确的是( )
要求函数的功能是交换 x 和 y 中的值, 且通过正确调用返回交换结果。能正确执行此功能的函数是( )
以下说法错误的是( )
以下程序运行后, 输出结果是
#include
void main(void)
{
char *s="defde";
s+=2;
printf("%d\n", s) ;
}
下面的程序的输出结果是( )
# include
fun( int *s, int n1, int n2 )
{
int i = 0;
int j = 0;
int t = 0;
i = n1;
j = n2;
while( i < j )
{
t = *( s + i ) ;
*( s + i ) = *( s + j ) ;
*( s + j ) = t;
i++;
j++;
}
}
main()
{
int a[ 10 ] = { 1, 2, 3, 4, 5, 6, 7, 8, 9, 0 } ;
int i = 0;
int *p = a;
fun( p, 0, 3 ) ;
fun( p, 4, 9 ) ;
fun( p, 0, 9) ;
for( i = 0; i < 10; i++ )
{
printf("%d", *(a + i ) ) ;
}
}
阅读下面的程序:
#include
#include
void fun( char *w, int m )
{
char s = 0;
char *p1 = NULL;
char *p2 = NULL;
p1 = w;
p2 = w + m - 1;
while( p1 < p2 )
{
s = *p1++;
*p1 = *p2--;
*p2 = s;
}
}
void main( void )
{
char a[] = "ABCDEFG";
fun( a, strlen(a) ) ;
puts( a ) ;
}
上面程序的输出结果是( )
