代码改变世界

随笔分类 -  C/C++基础

C/C++ 指针数组、二维数组

2015-09-09 18:40 by sylar_liang, 471 阅读, 收藏,
摘要: 一、 二维数组1> 初始化int a[3][3] = { {1,0,0}, {0,1,0}, {0,0,1} }; // 里面的括号是 {} , 而不是()2> 将二维数组当做一维数组处理// void Func(int array[3][10]) 相当于// void Func(int array... 阅读全文

C/C++ 编写一个通用的Makefile 来编译.c .cpp 或混编

2015-09-08 18:03 by sylar_liang, 2230 阅读, 收藏,
摘要: 1.虽然能编译出程序,但是会提示错误。目前暂未解决make: sinclude: Command not foundmake: *** [test] Error 1272. 后续主要要修改的部分:1>PROGRAM := hello # 设置运行程序名2> SRCDIRS := . # 源程序位于当... 阅读全文

C/C++ 定义接口文件格式

2015-09-08 17:03 by sylar_liang, 618 阅读, 收藏,
摘要: #ifndef _XXX_H_#define _XXX_H_#ifdef __cplusplusextern "C" {#endif// Interfacevoid PrintHelloWorld();#ifdef __cplusplus}#endif#endif // _XXX_H_ 阅读全文

string.h c源码实现

2015-09-03 17:00 by sylar_liang, 485 阅读, 收藏,
摘要: int isspace( char c ){ char comp[] = { ' ', '\t', '\r', '\n', '\v', '\f' }; const int len = 6; for ( int i=0; i= 'A' && c = s ); return NULL;}// 在字符... 阅读全文