
C
yanyanforest
Stay hungry,stay foolish。
展开
-
C-struct-01
一直以来,我认为结构体的size 是它里面所有成员变量size之和,今天才知道结构体的size >=成员变量的size之和.typedef struct STUDENT { char name[20]; char sex; int class; float score[3]; float total; float averag原创 2013-03-29 18:29:23 · 612 阅读 · 0 评论 -
C-指针-02
1. 数组指针:int *p[5]; 2. 指向数组的指针:int (*p)[5];//相当于一个二维数组 3. 指针的指针:int **p; 4. 指针函数:int *p();//函数的返回类型是某一类型指针的 指针函数一定有函数返回值,而且,在主调函数中,函数返回值必须赋给同类型的指针变量。 5. 函数指针:int (*p)();//无原创 2013-04-02 19:24:21 · 468 阅读 · 0 评论 -
求两个最大公约数
int gcd(int a,int b){ int max = a; int min = b; int temp = 0; int result ; //找出一个数与另一个中的大者 if (max temp = max; max = min; min = temp;原创 2013-04-15 18:30:20 · 494 阅读 · 0 评论 -
C-不用任何库函数,写一个内存拷贝函数
//拷贝长度为length字符串char*myMemcpy(char* dest, const char* source, size_t length){ char* ret = dest; // 判是否为空 if (!source||!dest) { return dest; } while (*source原创 2013-08-07 07:56:03 · 2052 阅读 · 0 评论