第1题:
执行下列语句后,输出结果为steven的是 Char * str="steven"; cout. write(str, );
A.strlen(str)
B.sizeof(str)
C.strlen(str+1)
D.sizeof(str-1)
第2题:
以下为 Windows NT 下的 32位 C++程序,请计算 sizeof的值
char str[] = “Hello” ; char *p = str ;int n = 10;请计算 sizeof (str )
= sizeof ( p ) = sizeof ( n ) = void Func (
char str[100]){请计算 sizeof( str ) = }
void *p = malloc( 100 );请计算 sizeof ( p ) =
第3题:
char str[ ]= "Hello";
char *p=str;
int n=10;
sizeof(str)=( )
sizeof(p)=( )
sizeof(n)=( )
void func(char str[100])
{ }
sizeof(str)=( )
第4题:
下列程序在32位linux或unix中的结果是什么?
func(char *str)
{
printf(" %d",sizeof(str));
printf(" %d",strlen(str));
}
main()
{
char a[]="123456789";
printf(" %d",sizeof(a));
printf(" %d",strlen(a));
func(a);
}
10 9 4 9
第5题:
下列程序在32位linux或unix中的结果是什么?
func(char *str)
{
printf("%d",sizeof(str));
printf("%d",strlen(str));
}
main()
{
char a[]="123456789";
printf("%d",sizeof(a));
func(a);
}
10 4 9
第6题:
设有结构体类型定义: struct try { int one; float two; }*str;若要动态开辟一个结构单元,使指针str指向其首地址,正确的语句是______。
A.str=(try*)malloc(sizeof(try));
B.*str=(struct try*)malloc(sizeof(struct try));
C.str=(strucy try*)malloc(sizeof(struct try));
D.str=(struc try)malloc(sizeof(struct try));
第7题:
执行下列语句后,输出结果为steven的是
char*str="steven";
eout.write(str, );
A.strlen(str)
B.sizeof(str)
C.strlen(str+1)
D.sizeof(str-1)
第8题:
如果有如下定义:constchar*str=“OK“;那么,sizeof(str)的值应该是()
A、1
B、2
C、3
D、4
第9题:
定义字符指针char *str="hello",已知sizeof(str)=4,则strlen(str)=______。