摘要: 1 #include <stdio.h> 2 3 int visit(int i , int j); 4 5 int maze[7][7] = { 6 {2,2,2,2,2,2,2}, 7 {2,0,0,0,0,0,2}, 8 {2,0,2,0,2,0,2}, 9 {2,0,0,2,0,2,2},10 {2,2,0,2,0,2,2},11 {2,0,0,0,0,0,2},12 {2,2,2,2,2,2,2},13 };14 int si = 1 , sj = 1 ;15... 阅读全文
posted @ 2011-08-19 20:31 MATRIX | yan 阅读(3570) 评论(0) 推荐(3) 编辑
摘要: 原理如图 , 采用双指针 1 struct node* lastn(struct node *head , int n) 2 { 3 struct node *p , *q ; 4 if(n < 1) 5 { 6 return NULL ; 7 } 8 9 P = head ;10 while(--n)11 {12 if(!p->next)13 {14 return NULL ;15 }16 else 17 p = p -> next ;18 }19 20 q = head ;21 while(p -> next)22 {23 q = q -> next ;24 阅读全文
posted @ 2011-08-19 19:03 MATRIX | yan 阅读(437) 评论(0) 推荐(0) 编辑
摘要: 1 /* *********************** 2 author : C / C# 3 data : 2011-8-19 4 Copyright 2011 5 *********************** */ 6 7 #include <stdio.h> 8 #include <stdlib.h> 9 #include <string.h> 10 11 #define N 5 12 13 void aver(score); 14 void menu(int *num , char *name , char *flag); 15 float *s 阅读全文
posted @ 2011-08-19 15:29 MATRIX | yan 阅读(1247) 评论(0) 推荐(1) 编辑
摘要: 1 函数类型 *函数名(形式参数表) //指针型函数就是返回值为指针地址的函数2 { 函数体 }函数执行后可以带回一个值给主调函数 ,这个值可以是标准类型的各种数据 , 也可以是不同类型的指针数据 ,然后使用这些指针间接的访问相关的数据如函数strchr()函数,它的功能是在一个字符串中查找一个字符 , 如果找到了则返回该字符的地址 ,否则返回空指针 1 #include <stdio.h> 2 3 char *strchr(char *str , char ch) 4 { 5 while(*str != ch && *str != '\0') 6 阅读全文
posted @ 2011-08-19 10:39 MATRIX | yan 阅读(8825) 评论(11) 推荐(0) 编辑
摘要: 1 函数类型 (* 函数指针变量)() ; //指向函数的入口地址一个函数是若干语句的集合 , 经编译后存储在函数代码存储区 , 并占有一片连续的存储空间 ,对函数指针只能用函数名赋值而无其他运算1 #include<stdio.h>2 3 int max(int x ,int y);4 5 int main()6 {7 int (* p)() ;//定义p是指向函数的指针变量8 int a , b , c ;9 10 p= max ;//将函数max的入口地址赋给指针变量p11 scanf("%d %d" ,&a ,&b) ;12 c= (* 阅读全文
posted @ 2011-08-19 09:06 MATRIX | yan 阅读(11537) 评论(1) 推荐(1) 编辑