随笔分类 -  c

摘要:1.文件中有一组整数,要求排序后输出到另一个文件中 答案: #i nclude #i nclude using namespace std; void Order(vector& data) //bubble sort{int count = data.size() ;for ( int i = 0... 阅读全文
posted @ 2012-08-13 15:02 children 阅读(1333) 评论(0) 推荐(0)
摘要:char cString[10]="hello world" 是初始化,合法。 char cString[10]; cString="hello world" 是赋值,这样赋值非法。原因在于声明了cString数组后,cString其实是一个char型的常量指针,而cString="hello w... 阅读全文
posted @ 2012-05-15 13:21 children 阅读(6186) 评论(0) 推荐(0)
摘要:http://blog.pfan.cn/xman/38666.html 阅读全文
posted @ 2012-04-17 11:49 children 阅读(170) 评论(0) 推荐(0)
摘要:优先级 运算符 名称或含义 使用形式 结合方向 说明 1 [] 数组下标 数组名[常量表达式] 左到右 () 圆括号 (表达... 阅读全文
posted @ 2012-04-05 15:22 children 阅读(252) 评论(0) 推荐(0)
摘要:char *string="abc" 中,是将string指向常量"abc",如果执行以下方法会报内存不能为written的错误: void change(char *s){ *s='A'; } 解决方法是定义string为字符数组: char string[]="abc"; 关于const的具... 阅读全文
posted @ 2012-02-11 23:11 children 阅读(624) 评论(0) 推荐(0)