随笔分类 -  C语言笔记

平时草稿
摘要:1. 正常 #include <assert.h> int main(){ int i = 0; assert(i == 0); //判断为真,程序正常退出 return 0;} 2. 异常 #include <assert.h> int main(){ int i = 1; assert(i == 阅读全文
posted @ 2023-03-13 17:11 gǒが油メo 阅读(11) 评论(0) 推荐(0) 编辑
摘要:函数声明: int pthread_once(pthread_once_t *once_control, void (*init_routine) (void)); 本函数使用初值为PTHREAD_ONCE_INIT的once_control变量保证init_routine()函数在本进程执行序列中 阅读全文
posted @ 2022-08-23 10:37 gǒが油メo 阅读(275) 评论(0) 推荐(0) 编辑
摘要:#include <stdio.h> struct s{ int a; int b; int c; char d;};void main(){ printf("%d",&((struct s *) 0)->a); //把结构体s的起始位置视为0,返回结构体s的成员a的位置【输出结果为0】 print 阅读全文
posted @ 2022-07-14 11:15 gǒが油メo 阅读(493) 评论(0) 推荐(0) 编辑
摘要:头文件:#include <termios.h> 函数原型:int cfsetispeed(struct termios *termptr, speed_t speed); int cfsetospeed(struct termios *termptr, speed_t speed); int cf 阅读全文
posted @ 2022-06-17 17:13 gǒが油メo 阅读(2546) 评论(0) 推荐(0) 编辑
摘要:1. tcgetattr函数 头文件:#include <termios.h> 函数原型:int tcgetattr(int fd, struct termios *termios_p); 说明:tcgetattr函数用于获取与终端相关的参数。参数fd为终端的文件描述符,返回的结果保存在termio 阅读全文
posted @ 2022-06-17 16:02 gǒが油メo 阅读(622) 评论(0) 推荐(0) 编辑
摘要:需要在函数内部进行跳转可以使用goto,在函数之间进行跳转就需要使用setjmp函数 #include <setjmp.h>int setjmp(jmp_buf envbuf);该函数将系统栈保存于envbuf中,以供以后调用longjmp()。当第一次调用setjmp(),它的返回值为0。之后调用 阅读全文
posted @ 2022-06-10 15:48 gǒが油メo 阅读(149) 评论(0) 推荐(0) 编辑
摘要:转自:https://blog.csdn.net/turkeyzhou/article/details/6104135#comments 四种返回字符串的方法: 1、 将字符串指针作为函数参数传入,并返回该指针。 将地址由入参传入: char* fun(char*s) { if (s) strcpy 阅读全文
posted @ 2022-03-15 10:20 gǒが油メo 阅读(5086) 评论(0) 推荐(0) 编辑

点击右上角即可分享
微信分享提示