结构体数组中元素为函数
摘要:这里能正常输出 -bash-3.2$ ./a.out 1 b1 b1 b-bash-3.2$ 若把结构体的数据类型改变: 结果也能正常显示 -bash-3.2$ ./a.out 1 b1 b1 b-bash-3.2$
阅读全文
posted @
2016-06-27 17:55
miracley
阅读(1336)
推荐(0)
assert
摘要:assert在C语言中的作用是: assert中的表达式为false,则终止程序继续执行。
阅读全文
posted @
2016-06-27 11:33
miracley
阅读(119)
推荐(0)
typedf
摘要:在代码中,我看到了类似这样的情况: typedf unsigned char BYTE; typedf BTYE * PBYTE; void foo(PBYTE A) { printf("%c\n",A); } int main(int args,char *arg[]) { BYTE *A='W'
阅读全文
posted @
2016-06-27 09:50
miracley
阅读(180)
推荐(0)
snprintf函数
摘要:原型为:snprintf(char *str, size_t size, const char *format, ...) 将可变个参数(...)按照format格式化成字符串,然后将其复制到str中 (2) 如果格式化后的字符串长度 >= size,则只将其中的(size-1)个字符复制到str中
阅读全文
posted @
2016-06-17 11:37
miracley
阅读(178)
推荐(0)
回调函数
摘要:#include<stdio.h> int f1(int x,int y)//返回大 { printf("this is f1\t\n"); return x>y?x:y; } int f3(int x,int y)//返回小 { printf("this is f3\t\n"); return x
阅读全文
posted @
2016-06-14 11:15
miracley
阅读(139)
推荐(0)
char
摘要:#include<stdio.h>#include<string.h> int main(int argc,char *arg[]){ char alls[4]={'a','b','c'}; printf("%s\n",alls);} c语言中,如果想直接输出char数组中的所用内容,直接输出数组名
阅读全文
posted @
2016-06-14 10:20
miracley
阅读(124)
推荐(0)
函数作为结构体成员变量
摘要:#include<stdio.h> typedef struct A { int a; char b; } foo;int f2(){ printf("this is f2\n"); return 2;} void f3(int x,char y){ printf("this is f3 + %d\
阅读全文
posted @
2016-06-14 10:01
miracley
阅读(898)
推荐(0)