随笔分类 -  c语言笔记

摘要:1 /** 2 * 循环单链表的实现 3 */ 4 #include <stdio.h> 5 #include <stdlib.h> 6 7 typedef struct List { 8 int data; 9 struct List *pNext; 10 } *List; 11 12 /** 1 阅读全文
posted @ 2021-08-31 17:06 新生代农民工 阅读(74) 评论(0) 推荐(0)
摘要:1 #include <stdio.h> 2 #include <stdlib.h> 3 4 typedef struct Node { 5 int data; 6 struct Node *next; 7 } Node, *LinkList; 8 9 LinkList initList() { 1 阅读全文
posted @ 2021-08-29 09:00 新生代农民工 阅读(43) 评论(0) 推荐(0)
摘要:1 #include<stdio.h> 2 #include <malloc.h> 3 #include <stdbool.h> 4 5 #define LIST_INIT_SIZE 100 // 线性表空间初始分配量 6 #define LIST_INCREMENT 10 //线性表存储空间的分配 阅读全文
posted @ 2021-08-18 13:30 新生代农民工 阅读(64) 评论(0) 推荐(0)
摘要:scanf函数返回成功读入的数据项数,读入数据时遇到了“文件结束”则返回EOF。 如: 1 scanf("%d %d",&a,&b); 函数返回值为int型。如果a和b都被成功读入,那么scanf的返回值就是2; 如果只有a被成功读入,返回值为1; 如果a和b都未被成功读入,返回值为0; 如果遇到错 阅读全文
posted @ 2020-11-29 20:56 新生代农民工 阅读(270) 评论(0) 推荐(0)
摘要:#include<stdio.h>int main(){ int a1, a2; char c1, c2; scanf("%d%d", &a1, &a2); scanf("%c%c", &c1, &c2); printf("%d %d %c %c", a1, a2, c1, c2); } 输入10 阅读全文
posted @ 2020-03-10 21:09 新生代农民工 阅读(3923) 评论(0) 推荐(0)
摘要:printf("%nd"); 即以十进制输出n位,若不足则左边补0,若超出则全部输出; printf("%3d"); 即以十进制靠右输出三位,不足用空格补充; printf("%-3d"); 即以十进制靠左输出三位,不足用空格补充; %u 无符号位十进制即(0~65535); printf函数若超出 阅读全文
posted @ 2020-03-10 20:29 新生代农民工 阅读(1612) 评论(0) 推荐(0)