字符串
字符串是一种数据结构类型,相应的,包括最基础的如string标准库中的一些字符串比较、拷贝、复制、子串查找、倒置等常规操作便应运而生。
更复杂一些的, 还有如字典树、字符串哈希、KMP算法、前缀/后缀问题、ASC自动机、后缀树、回文树、Manacher等拓展的高级算法都在此分类下。
-
有以下程序:#include <stdio.h> #include <string.h> main() { char name[9]="c##line"; char *str=name; printf("%d,%d,%d,%d\n", sizeof(name), strlen(name), sizeof(str), strlen(str)); }程序运行后的输出结果是()。
-
有如下程序:#include <stdio.h> #include <string.h> main() { char name[10]="c-book"; char *str=name; printf("%d,%d,%d,%d\n", sizeof(name), strlen(name), sizeof(str), strlen(str)); }程序运行后的输出结果是()。
-
有如下程序:#include <stdio.h> #include <string.h> main() { char a[]="THIS", *b="OK"; printf("%d,%d,%d,%d\n", strlen(a), sizeof(a), strlen(b), sizeof(b)); }程序运行后的输出结果是()。
-
有以下程序:#include <stdio.h> #include <string.h> main() { char x[]="STRING"; x[0]=0; x[1]='\0'; x[2]='0'; printf("%d %d\n",sizeof(x),strlen(x)); }程序运行后的输出结果是()。
-
有以下程序:#include <stdio.h> #include <string.h> main() { char str[]={"Hello,Beijing"}; printf("%d,%d\n",strlen(str),sizeof(str)); }程序的运行结果是()。
-
有以下程序:#include<stdio.h> #include<string.h> main() { char a[10]= "abcd"; printf("%d,%d\n",strlen(a),sizeof(a)); }程序运行后的输出结果是()。
-
有如下程序:#include <stdio.h> #include <string.h> main() { printf("%d\n",strlen("0\t\nA011\1")); }程序运行后的输出结果是()。
-
以下语句的输出结果是()。printf("%d\n",strlen("\t\"\065\xff\n"));
-
若有以下定义和语句:char s1[10]="abcd!", *s2="n123\\"; printf("%d%d\n", strlen(s1), strlen(s2));则输出结果是()。
-
以下不能将s所指字符串正确复制到t所指存储空间的是()。
-
若有定义语句:char str1[] = "string", str2[8], *str3, str4[10] = "string";库函数strcpy的功能是复制字符串,以下选项中错误的函数调用是()。
-
若有定义语句char*s1="OK",*s2="ok";以下选项中能够输出"OK"的语句是()。
-
字符数组a和b中存储了两个字符串,判断字符串a和b是否相等,应当使用的是()。
-
下列选项中,能够满足“若字符串s1等于字符串s2,则执行ST”要求的是()。
-
若有定义语句char s[10]="1234567\0\0",则strlen(s)的值是()。
-
以下关于字符串的叙述中正确的是()。
-
有以下程序#include <stdio.h> void fun(char **p) { ++p; printf("%s\n",*p); } main() { char *a[] = {"Morning", "Afternoon", "Evening", "Night"}; fun(a); }程序的运行结果是()。
-
有以下程序#include <stdio.h> main() { char c[2][5]={"6938","8254"},*p[2]; int i,j,s=0; for(i=0;i<2;i++) p[i]=c[i]; for(i=0;i<2;i++) for(j=0;p[i][j]>0;j+=2) s=10*s+p[i][j]-'0'; printf("%d\n",s); }程序运行后的输出结果是()。
-
有以下程序:#include <stdio.h> main() { char *s[6]={"ABCD","EFGH","IJKL","MNOP","QRST","UVWX"},**p; int i; p=s; for(i=0;i<4;i++)printf("%s",p[i]); printf("\n"); }程序运行后的输出结果是()。
-
有以下程序:#include <stdio.h> #include <string.h> main() { char *mm[4]= {"abcd", "1234", "mnop", "5678"}; char **pm= mm; int i; for(i=0;i<4;i++) printf("%s",pm[i]+i); printf("\n"); }程序的运行结果是()。