C技能树
技术鱼
一条在技术的海洋中漫游的飞鱼。
展开
专栏收录文章
- 默认排序
- 最新发布
- 最早发布
- 最多阅读
- 最少阅读
-
C语言-代码开发
#if 、#ifdef、 #if defined()#if的使用说明#if x...code...#else...code...#endif#if的后面接的是表达式#if (MAX10)||(MAX20) code… #endif它的作用是:如果(MAX10)||(MAX20)成立,那么编译器就会把其中的#if 与 #endif之间的代码编译进去(注意:是编译进去,不是执行!!)#if defined()的使用#if后面接的是一个宏。#if defined (x) ...code原创 2021-07-14 23:26:24 · 225 阅读 · 3 评论 -
C语言-指针系列
指针常见错误使用案例指针的传递常见错误(1)使用一级指针 1 #include <stdio.h> 2 #include <string.h> 3 #include <malloc.h> 4 5 /**错误实例*/ 6 7 void test(char *p) 8 { 9 p = (char *)calloc(1,200*sizeof(char)); 10 if( p == NULL) 11 {原创 2021-07-14 22:57:55 · 119 阅读 · 0 评论 -
柔性数组理解
目录柔性概念定义特点性能参考柔性概念零长度数组(Arrays of Length Zero)也叫做可变数组/柔性数组。 在c99中,对于结构体中的最后一个成员,可以允许最后一个成员是未知大小的数组,这样的数组就叫做柔性数组。定义struct udppkt { struct ethhdr et; struct iphdr ip; struct udphdr udp; unsigned char data[0];//定义零长数组或柔性数组,1.不需原创 2021-12-08 00:12:40 · 267 阅读 · 0 评论
分享