ChinaUnix.net
相关文章推荐:

c 字符串比较

================================================== Keywords: String Literal, Object, Array, Lvalue Author: whyglinux com> Date: 2007-05-16 ================================================== cc++ 字符串字面量(String Literal)既有相同之处,又有一些区别。了解这些内容对于加深字符串字面量以及相关一些概念的理解、澄清一些常见的概念误区不无助益。本文以普通字符串字面量 ...

by whyglinux - C/C++ - 2012-08-18 12:00:01 阅读(14674) 回复(12)

相关讨论

c和awk处理字符串的速度比较,那个快? 如果是c,要一个文本读进内存,然后用字符串函数匹配,查找关键字。 如果是awk,则一个脚本可以处理。 但哪个速度快?耗的资源少呢? c把文本读入内存还是比较耗内存。

by greatho1507 - C/C++ - 2009-02-20 13:24:20 阅读(2205) 回复(4)
by redor - 程序开发 - 2006-07-27 22:36:09 阅读(1088) 回复(3)

比如有三个字符串 A "There are so many people" B "There are so many %s" c "%s,there are so many" 比较A和B,找出不同的地方后,用A中的不同单词替换c中的“%s” 以上面这个例子来说,就是比较A和B,发现A中的“people”和B中的“%s”不一样,于是用A中的“people”替换c中的“%s”,最终c变为“people,there are so many” 这个操作怎么完成啊,给个思路就行!

by DreamMyth - C/C++ - 2004-08-02 22:47:03 阅读(1238) 回复(5)

【手把手教你用c语言开发Windows程序】:俄罗斯广场、影音播放器、贪吃蛇、学生管理系统 http://www.rupeng.com/forum/jian-3391.html 大家都知道,在c语言中两上字符串是不能直接进行比较的,我们一般使用中的字符串比较函数strcmp()来进行两个字符串比较。那么,为什么不允许两个字符串直接进行比较呢?可做如下解释: 有如下代码: char s1[] = "abc"; char s2[] = "abc"; 如果直接进行比较: if (s1 == s2) { ...

by lanlishi - C/C++ - 2009-07-15 11:12:27 阅读(1758) 回复(3)
by aaaaal - C/C++ - 2005-09-20 18:07:59 阅读(3353) 回复(19)

[code] #include int main(void) { printf("abc def\n"); return 0; } [/code] 上面代码编译有错,下面代码可以,难道字符串不能跨行表示吗?(不借用转义字符),看来 c 格式代码也不是完全的自由 [code] #include int main(void) { printf("abc\ def\n"); return 0; } [/code]

by izhier - C/C++ - 2008-10-21 22:08:19 阅读(7392) 回复(9)

char *a="hello" "hello"; printf("%s", a); 还有 printf("hello" "world"); 编译通过,运行正常,为何? 难道编译器支持这种字符串写法?

by izhier - C/C++ - 2008-10-16 09:18:14 阅读(2060) 回复(7)

[code] int main() { char *chr; memset( chr, 0, 10 ); } [/code] 运行出现 段错误 帮忙分析一下 g++3.2编译

by karabiner - C/C++ - 2004-11-04 11:55:21 阅读(1072) 回复(7)

给出一系列的串 c[m][n] 给出一个字符串 a[n] 怎么样在c[m][n]中判断是否有a[n]的前缀或者和a[n]同名的文件

by DraculaW - C/C++ - 2007-07-17 15:47:35 阅读(3256) 回复(4)

小弟写了一个,感觉不太好,各位有没有更好的,拿出来共享一下。 [code] #include ; #include ; #include ; #include <ctype.h>; #include ; void get_rand_str(char s[],int number) { char str[64] = "00123456789ABcDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz"; int i; char ss[2]; //printf("%c %c\n",str[1],str[62]); srand((unsigned int)time((time_t *)NULL)); f...

by thoujean - C/C++ - 2004-09-10 16:59:29 阅读(8689) 回复(4)