![](https://static.youtibao.com/asksite/comm/h5/images/m_q_title.png)
设char str[100];int I=5;,则引用数组元素的错误形式的是()A.str[I+10] B.*(srr+I)C.(str+I-1)
设char str[100];int I=5;,则引用数组元素的错误形式的是()
A.str[I+10]
B.*(srr+I)
C.(str+I-1)
D.*(&(str++)+I)
![](https://static.youtibao.com/asksite/comm/h5/images/solist_ts.png)
设char str[100];int I=5;,则引用数组元素的错误形式的是()
A.str[I+10]
B.*(srr+I)
C.(str+I-1)
D.*(&(str++)+I)
若输入I have a test.,则以下程序的运行结果为【 】。 include<stdio.h> main() { FILE*fp; char str[100],filename[10]; int i=0; if ((fp=fopen("test","w"))==NULL) { printf("can not open the file!\n"); exit(0); } getchar(); gets(str); while(str[i]!=) { if (str[i]>=a && str[i]<=z) str[i]=str[i]-32; fputc(str[i],fp); i++; } fclose(fp); fp=fopen("test","r"); fgets(str,strlen(str)+1,fp); printf("%s\n",str); fclose(fp); }
以下程序的功能是计算字符串的长度。请填空。
#include<stdio.h>
main()
{char str[100],*sp=str;
int nlen=0;
scanf("%s",str);
for(;*sp!='\0';sp++)______;
printf("%d",nlen);
}
下述函数用于统计—行字符中的单词个数,单词之间用空格分隔。 word_num(str) char str[]; {int,num=O,word=O; for(i=0;str[i]!=【 】;i++) if(【 】=")wprd=0 else if(word=O) { word=1: 【 】; } return(num); }
下述函数用于统计一行字符中的单词个数,单词之问用空格分隔。 word_num(str) char str[]; {int i,num=0,word=0; fot(i=0;str[i]!=【 】;i++) if 【 】==)word=0; else if(word==0) { word=1; 【 】; } return(num); }
下面的程序可对指定字符串中的字符串进行从大到小排序,请将程序填完整。 (注:程序采用了冒泡排序法) include<stdio.h> include<string.h> main() { char*str="ABCDabcd",temp; int n,i; n=strlen(str); while(n-->1) for(i=0;i<n;i++) if(str[i]<str[i+l]) { temp=【 】; str[i]=str[i+l]; 【 】=temp; } printf(【 】); }
下面的程序可对指定字符串中的字符串进行从大到小排序,请将程序填完整。(注:程序采用了冒泡排序算法) include<stdio.h> include<string.h> main() { char *str="ABCDabcd",temp; int n,i; n=strlen(str); while(n->1) for(i=0;i<n;i++) if(str[i]<str[i+1]) { temp=【 】; str[i]=str[i+1]; 【 】=temp; } printf(【 】); }
下面的程序可列指定字符串中的字符串进行从大到小排序,请将程序填完整。(注:程序采用了冒泡排序算法) include<stdio.h> include<string.h> main() { char*str="ABCDabcd",temp; int n,i; n=strlen(str); while(n->1) for(i=0;i<n;i++ if(str[i]<str[i+1]) { temp=【 】; str[i]=str[i+1]; 【 】=temp; } printf(【 】); }