`
birthdog
  • 浏览: 9514 次
最近访客 更多访客>>
社区版块
存档分类
最新评论
文章列表
#include"stdio.h" #include"malloc.h" typedef struct Tree { char ch; struct Tree *left; struct Tree *right; }Tree; typedef struct Stack { Tree *data; struct Stack *next; }Stack; void Push(Stack *s, Tree *p) { Stack *r; r = (Stack *)malloc(sizeof(Stack ...
#include"stdio.h" #include"malloc.h" #define MAX 7 typedef struct{ int queue[MAX]; int front; int rear; }Queue; void InitQueue(Queue *&q) { q = (Queue *)malloc(sizeof(Queue)); q->front = q->rear = 0; } int isFull(Queue *q) { if((q->rear+ ...
#include"stdio.h" #include"malloc.h" typedef struct LNode { int data; LNode *next; }LNode; typedef struct { LNode *front; LNode *rear; }Queue; void InitQueue(Queue *&q) { q = (Queue *)malloc(sizeof(Queue)); q->front = q->rear = NULL; } v ...
#include"stdio.h" #include"malloc.h" typedef struct Node { int data; Node *next; }Node; void InitStack(Node *&top) { top = (Node *)malloc(sizeof(Node)); top->next = NULL; } void createStack(Node *top) { printf("Input data,input -1 to end:&q ...
#include"stdio.h" #include"malloc.h" typedef struct DNode { int data; DNode *prior, *next; }DNode; void InitDNode(DNode *&p) { p = (DNode *)malloc(sizeof(DNode)); p->prior = NULL; p->next = p; } void createDNode(DNode *p) { int n; DNode *r, ...
#include"stdio.h" #include"malloc.h" typedef struct Node { int data; Node *next; }Node; void InitNode(Node *&p) { p = (Node *)malloc(sizeof(Node)); p->next = NULL; } // 头插法建立单链表 void createfromhead(Node *p) { int n; Node *q,*r; r = p->nex ...
原文链接:http://tianyou8.blog.hexun.com/48362947_d.html 引用是C 中的概念,初学者容易把引用和指针混淆一起。 一下程序中,n是m的一个引用(reference),m是被引用物(referent)。 int m; int &n = m; n相当于m的别名(绰号),对n的任何操作就是对m的操作。 所以n既不是m的拷贝,也不是指向m的指针,其实n就是m它自己。 引用的规则: (1)引用被创建的同时必须被初始化(指针则可以在任何时候被初始化)。 (2)不能有NULL引用,引用必须与合法的存储单元关联(指针则可以是NULL)。 ...
#include"stdio.h" #include"malloc.h" #define MAXSIZE 100 typedef struct List { int data[MAXSIZE]; int length; }List; int InitList(List * &p) { p = (List *)malloc(sizeof(List)); if(p== NULL) { printf("Can not distribute memory\n"); retur ...
C语言中的精华是什么,答曰指针,这也是C语言中唯一的难点。 C是对底层操作非常方便的语言,而底层操作中用到最多的就是指针,以后从事嵌入式开发的朋友们,指针将陪伴我们终身。 本文将从八个常见的方面来透视C语言 ...
接着写,指针与字符串      C 语言规定,字符串常量是由双引号括起来的字符序列。但是,在 C 语言中没有字符串变量这一个说法。这是因为 在 DOS 模式下,字符串变量的长度可长可短,对应的存储空间需求分配是不可预知的。         对于字符串常量的操作,可以采用字符数组和指针两种形式实现。      例如:使用字符数组存储字符串 char s[] = "Good midnight! "; 此时,方括号内才数字可以不填写,将在编译时    由编译系统自动填充为 16。      由于数组与指向数组的指针变量之间的对应关系,字符串也可以选择指针来处理。      例如 ...
   今天写比较容易忘记的指针与数组。 (1)指针变量的定义:    指针同样也是一类变量,和其他普通变量一样,具有值并且有一定的存储空间;它和普通变量不一样的是:存放在该空间内的值是另一个变量的地址,而那个变 ...
    马上要大学毕业了,学了计算机,结果现在以前学的全忘了,有点感觉像被废了武功一样,真是悲催。最郁闷的是,看着日子一天天过,还是不想学习,难道我的冷却时间要这么长?感觉考研就像去骑老虎一样,有的人骑到 ...
It's time for a new year and a new you, but perhaps your heart is not in it this time around. Maybe you're jaded from too many failed New Year's resolutions, or maybe you're just not feeling motivated these days. Here are a few reasons why you may not be feeling it: 新年到了你也该有新面貌。但也许你的心还没有做好准备。也许你厌倦了太多 ...
After I become a senior,I find that English is so important for me.I can find many good website and masterpiece in English, and the most important is that lots blogs in  home are so shallow,it's really hard for me to understand the essence. But these days when I attempt to search some foreign website ...
Global site tag (gtag.js) - Google Analytics