随笔分类 - C语言(案例)
大学四年第一门计算机语言---C语言学习过程:
摘要:1 /* 2 *@author ? 3 *@since 2011/07/29 4 *@function 实现链表的常用操作,比较粗糙。 5 * 功能大概是:显示链表结构;查询链表;删除节点;插入结点;修改结点 6 */ 7 #include <stdio.h> 8 #include <stdlib.h> 9 10 struct node 11 { 12 int value; 13 struct node *next; 14 }; 15 /* 16 *插入结点(单个) 17 */ 18 struct node *add_to_list(struct node *list,
阅读全文
摘要:此次案例注重讲解:指针数组、数组指针以及函数指针的应用。有一点难度,需要只需琢磨!代码如下: 1 /* 2 @author zengweilin 3 @2011/6/16 指针的应用举例 4 @notice:声明在C语言函数中只能放在开头,切记!!! 5 */ 6 #include "stdio.h" 7 #include "stdlib.h" 8 /*返回指向函数的指针*/ 9 int* fun(int a){10 return &a;11 }12 int main(){13 /*<1>*/14 int *a=fun(10);15
阅读全文
摘要:1 /* 2 @author zengweilin 3 @2011/6/13 万年历 4 */ 5 #include "stdio.h" 6 #include "stdlib.h" 7 int isLeapYear(int); 8 int main(){ 9 /* i 月份前的空格数目, 10 year 用户输入的年份, 11 day 当前月份的天数, 12 year_start 循环小于year年份的变量, 13 per_year_day 年天数(区分闰年与非闰年), 14 */ 15 int i,year,day=1,year_start=0,per
阅读全文
摘要:1 /* 2 @2011/6/14 螺旋方阵 3 @author zengweilin 4*/ 5 #include "stdio.h" 6 #include "stdlib.h" 7 8 void widdershins(int); 9 void deasil(int); 10 11 int main(){ 12 int n; 13 printf("please input the value of n: "); 14 scanf("%d",&n); 15 while(n<=0) 16 { 17 p
阅读全文
浙公网安备 33010602011771号