c语言练习
文章平均质量分 65
4M小水管
这个作者很懒,什么都没留下…
展开
专栏收录文章
- 默认排序
- 最新发布
- 最早发布
- 最多阅读
- 最少阅读
-
多个结构体的函数应用
#include #include #include #include typedef struct people_name { void (*name)(); }people_name; typedef struct tell { void (*tell)(); }Ptell; void show_name() { prin原创 2012-10-05 20:40:39 · 810 阅读 · 0 评论 -
结构体调用结构体的函数
#include #include #include typedef struct tell { void (*tell)(); }Ptell; void his_tell() { printf("4m 小水管"); } typedef struct call { Ptell* tell; void (*ll_call原创 2012-10-05 20:54:22 · 3368 阅读 · 0 评论 -
倒序算法
#include int main() { int len,i; int buf[6] ={1,2,3,4,5,6 }; len = 6; for (i = 0; i < len/2; i++) //该循环用于对数组buf中的元素进行倒序排序 { char tmp; tmp = buf[i]; buf[i] = buf[len-i-1];原创 2012-11-11 10:19:57 · 1017 阅读 · 0 评论 -
scanf
#include int main(void) { int i; scanf("u%d",&i);//必须输入以u开头的字母比如u123 printf("i=%d\n",i); return 0; } #include int main(void) { int i,j; char ch; scanf("%d",&i); while((ch=getchar原创 2012-11-13 19:23:31 · 445 阅读 · 0 评论 -
指针互换
#include void bianhuan(int *p,int*q) { int t; t=*p; *p=*q; *q=t; } int main(void) { int a=3; int b=5; printf("a=%d,b=%d\n",a,b); bianhuan(&a,&b); printf("a=%d,b=%d",a,b);原创 2012-11-13 20:27:57 · 747 阅读 · 0 评论 -
环形缓冲区和c笔记
环形缓冲区其实就是数组buf【len】 1.空的时候buf[w]=buf[r] 2.写:buf[w]=val w=(w+1)%len; 3.读val=buf[r]; r=(r+1)%len; 4.满 (w+1)%len=r 1.const 用来声明不可改变的变量 int const *pci 可以改变指针的但不能改变指向的值 int *const pci 可以改变指向的原创 2012-10-06 18:05:28 · 1014 阅读 · 0 评论 -
链表创建和链表遍历
#include #include #include typedef struct node { int data ; struct node *pNext; }NODE,*PNODE; PNODE creat_list(void); void traverse_list(PNODE pHead); int main() { PNODE pHead=NULL;原创 2012-12-13 14:48:37 · 868 阅读 · 1 评论 -
mallo.c
#include int main() { int a[5]={4,12,2,8,6};//静态,坏处长度确定又不可以释放 int len; double *p; printf("请输入长度%d",sizeof(p));//所有指针地址长度为4个字节 ,但sizeof(*p)就要看*P指向的类型而决定 scanf("%d",&len);//注意是 &原创 2012-12-13 14:49:24 · 574 阅读 · 0 评论 -
记录每次调试的错误
一.段错误: 原因:1.每个函数没赋值 2.函数赋错值。 解决方法:用打印跟踪,检查函数的参数 printf("xxxx \n");如果不加\n有时候会不输出 二。个函数调用出错 1.首先查看这个函数实现的文件 2.再看这个函数的文件的头文件有没有申明这个函数 3.看函数的返回和参数类型是否相同 三.malloc出错 ptNew = malloc(sizeof(T_Vide原创 2013-04-14 10:24:53 · 1485 阅读 · 0 评论
分享