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 ...
随机推荐
- mysql source命令超大文件导入方法总结
本文章来给各位朋友介绍利用mysql source命令超大文件导入方法总结,下面收集了两种解决办法,一种是把数据库分文件导出然后再导入,另一种是修改my.ini配置文件,下面我一一给各位朋友介绍. 导 ...
- UVa 679 小球下落
题意:这道题规律性极强,虽然是二叉树,但是可以用模拟来写. 1<<20 意思是1的二进制左移20位,即2的20次方. 对于二叉树中一个节点 k ,其左节点,右节点的编号分别是2k 和 2k ...
- Oracle学习系列1-7
Oracle学习系列1 两个服务必须启动: OracleOraDb10g*TNListener 和 OracleService*** 使用sqlplusw先进行环境的设置 set linesize 3 ...
- [hdu 3376]Matrix Again
这题就是真正的费用流了,用 大屁 就算不超时,你也有个 CE :数组 so large 拆点,费用取反,最大费用最大流即可了喵~ 不过似乎这题很不兼容 dijkstra 的样子 就算用 spfa 重赋 ...
- Deleting backup_label on restore will corrupt your database!
The quick summary of this issue is that the backup_label file is an integral part of your database c ...
- python基础教程之抽象
很早知道python,但没有坚持学习.最近心血来潮,但能弥补这个遗憾. 对象几个重要概念: 多态:可以对不同类的对象使用同样的操作: 封装:对外部世界隐藏对象的工作细节: 继承:以普通的类为基础建立专 ...
- (C#) Tasks 中的异常处理(Exception Handling.)
多线程编程中要注意对线程异常的处理.首先写个例子. 一个线程用于显示信息(Show Messages).主线程用于做其他工作(Do Works). using (Task taskShowMessag ...
- php操作文件及下载图片脚本
<?php set_time_limit(0); $handle = fopen('article.txt','r'); for($i=0;$i<1;$i++) { $count = 0; ...
- Android广播机制简介
为什么说Android中的广播机制更加灵活呢?这是因为Android中的每个应用程序都可以对自己感兴趣的广播进行注册,这样该程序就只会接收到自己所关心的广播内容,这些广播可能是来自于系统的,也可能是来 ...
- EF框架 转载
http://www.cnblogs.com/zrdm/p/5060360.html Model First Model First我们称之为"模型优先",这里的模型指的是&quo ...