==================================================
Keywords: String Literal, Object, Array, Lvalue
Author: whyglinux
by whyglinux - C/C++ - 2012-08-18 12:00:01 阅读(14674) 回复(12)
c和awk处理字符串的速度比较,那个快? 如果是c,要一个文本读进内存,然后用字符串函数匹配,查找关键字。 如果是awk,则一个脚本可以处理。 但哪个速度快?耗的资源少呢? c把文本读入内存还是比较耗内存。
比如有三个字符串 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” 这个操作怎么完成啊,给个思路就行!
【手把手教你用c语言开发Windows程序】:俄罗斯广场、影音播放器、贪吃蛇、学生管理系统
http://www.rupeng.com/forum/jian-3391.html
大家都知道,在c语言中两上字符串是不能直接进行比较的,我们一般使用
[code]
#include
char *a="hello" "hello"; printf("%s", a); 还有 printf("hello" "world"); 编译通过,运行正常,为何? 难道编译器支持这种字符串写法?
小弟写了一个,感觉不太好,各位有没有更好的,拿出来共享一下。
[code]
#include