C basics
C 日记目录
C basics ................
writing Numeration
storage , structor space assigning
pointer, array
others
___________________________________-
c coding
1. define empty pointer
#define NULL ((void*)0)
应用程序是不能访问0地址的,所以可以用0地址来表示一个空指针。
利用指针之前(例如作为形参的指针)需确保该指针有效:
if( ptr != NULL)
2, define fucntion pointer type
typedef void (*pf)(void*)
//函数名本来就是地址
____strlen() //字符串的长度不包括 '\0'.
sizeof("hello") 长度包括 '\0'.
__________________________________
数组和指针
int *pT;
int a[5] = {0};
____指针当作数组用. 如果你不需要改变这个指针而要用到它为索引的数,用数组的格式来调用这个数。
aBuf[i] =pT[i];
____数组a[5],编译器编译后,
1,a+1 为 a + 1*sizeof(int). // a[0]+1*sizeof(a[0])
2,&a 为&a[0],//就是a
3,&a+1, a 是数组,类型为 int(*)[5], a + sizeof(a) = a + 5*sizeof(int)
___指针能够有自己的地址: &pT. 和数组不同,上面2,&a 就是a.
___ lsearch 中的应用
char *key = "rabbit"; //key[] wrong
http://www.cnblogs.com/aprilapril/p/4333173.html
C basics的更多相关文章
- Assembler : The Basics In Reversing
Assembler : The Basics In Reversing Indeed: the basics!! This is all far from complete but covers ab ...
- The Basics of 3D Printing in 2015 - from someone with 16 WHOLE HOURS' experience
全文转载自 Scott Hanselman的博文. I bought a 3D printer on Friday, specifically a Printrbot Simple Metal fro ...
- Cadence UVM基础视频介绍(UVM SV Basics)
Cadence关于UVM的简单介绍,包括UVM的各个方面.有中文和英文两种版本. UVM SV Basics 1 – Introduction UVM SV Basics 2 – DUT Exampl ...
- Xperf Basics: Recording a Trace(转)
http://randomascii.wordpress.com/2011/08/18/xperf-basics-recording-a-trace/ This post is obsolete ...
- Xperf Analysis Basics(转)
FQ不易,转载 http://randomascii.wordpress.com/2011/08/23/xperf-analysis-basics/ I started writing a des ...
- Radio Basics for RFID
Radio Basics for RFID The following is excerpted from Chapter 3: Radio Basics for UHF RFID from the ...
- 【IOS笔记】View Controller Basics
View Controller Basics 视图控制器基础 Apps running on iOS–based devices have a limited amount of screen s ...
- NSInvocation Basics
In this article I'm going to cover the basics and usages of NSInvocation. What is NSInvocation? Appl ...
- Qt 线程基础(Thread Basics的翻译,线程的五种使用情况)
Qt 线程基础(QThread.QtConcurrent等) 转载自:http://blog.csdn.net/dbzhang800/article/details/6554104 昨晚看Qt的Man ...
随机推荐
- 解决ListView和ScrollView同时使用时滑动的冲突问题
ScrollView外面包裹了一个ListView,解决其滑动冲突问题: 只需自定义ListView,命名MyListView: public class MyListView extends Lis ...
- python数据结构与算法——图的广度优先和深度优先的算法
根据维基百科的伪代码实现: 广度优先BFS: 使用队列,集合 标记初始结点已被发现,放入队列 每次循环从队列弹出一个结点 将该节点的所有相连结点放入队列,并标记已被发现 通过队列,将迷宫路口所有的门打 ...
- centos7 查询jdk安装路径
- 《C与指针》第十章练习
本章问题 1.成员和数组元素有什么区别? answer:Structure members can be all different types;they are accessed by name;a ...
- 【Jenkins】jenkins简单搭建并执行任务
part 1 jenkins用户名的配置(gerrit 2.11) #安装jenkins $ sudo apt-get install jenkins #为jenkins用户设定密码 $ sudo ...
- xampp 文件夹拷贝的注意事项。
xampp可以同盘符拷贝,比如由A电脑的D:\XAMPP拷贝到B电脑的D:\XAMPP,此拷贝不用修改任何设置,当进行不同盘拷贝时,要修改apache和mysql下的一大堆conf文件,修改盘符: x ...
- centos7+nginx 1.9.0+php-fpm+phpstorm+xdebug+vmware开发环境搭建
1.php-fpm yum install php-fpm 默认配置在本地9000端口监听 service php-fpm restart启动 2.nginx 1.9.0 需先安装gcc zlib o ...
- Java入门教程总目录
Java入门教程总目录 持续更新中... 1.Java常识汇总 2.Java框架对比 3.Java技术路线 4.Java编码规范 5.Java环境变量配置 6.枚举 7.操作符 12.定时任务
- shell 脚本定时创建月份表
#!/bin/shuser='root'pass='root'name='vfc_sport' # 数据表名定义timestamp=`date -d "next month" +% ...
- 使用它tshark分析pcap的例子以及scapy下载地址
转一篇cisco工作人员使用tshark分析pcap的文章,以及scapy的下载地址 http://blogs.cisco.com/security/finding-a-needle-in-a-pca ...