第六周字符串处理.pptVIP

  • 1
  • 0
  • 约1.02万字
  • 约 33页
  • 2017-05-28 发布于四川
  • 举报
一个简单的字符串操作的例子 #includestring.h #includestdio.h char strl[] = “The quick brown dog jumps over the lazy fox”; char str2[50] =“The QUICK brown dog Jumps over the lazy fox”; char str3[40] =“The QUICK brown dog Jumps over the lazy fox”; //错误:字符串共有43个字符,需要一个长度至少为44的字符串变量存储。 //易忽略在字符串的末尾要添加表示结束的额外标志字符’/0’。 char str4[50]; void main(void) { int result; str4 =“The QUICK brown DOG jumps over the lazy fox”; //错误:不能将一个字符串常量赋值给另一个字符串变量。 str4=str2; //错误:不能将一个字符串变量赋值绘另一个字符串变量 str4=str1; //错误:不能将一个字符串变量赋值给另一个字符串变量 printf(“Compare strings:\n\t%s\n\t%s\n\n”,strl,str2); } Look and Say 3

文档评论(0)

1亿VIP精品文档

相关文档