数据结构的简单学习1
2013-12-20 18:13
197 查看
#include<stdio.h> #include<string.h> #include<malloc.h> typedef struct { char name[10]; //姓名 unsigned int age; //年龄 }people; void main() { char *tempName; int age; people stu; printf("Please enter the following information(name,years):\n "); tempName=(char*)malloc(sizeof(char)*10); //#分配内存给tempName scanf("%s %d",tempName,&age); stu.age=age; strcpy(stu.name,tempName); printf("Name=%s,Age=%d\n",stu.name,stu.age); free(tempName); //#释放内存 }
我写了一个小程序,主要功能就是利用一个结构体存储信息。
相关文章推荐
- 学习数据结构搜索的的意外收获哈。一个简单的基于java的网页抓取程序。
- 数据结构之简单算法学习
- 数据结构的简单学习3
- 算法设计和数据结构学习_5(BST&AVL&红黑树简单介绍)
- 数据结构的简单学习5
- Common Lisp学习之四:简单数据结构及处理
- (二)数据结构学习笔记 简单堆栈,STL中堆栈的实现
- 数据结构学习笔记(7.栈的应用及简单的计算器)
- 算法设计和数据结构学习_5(BST&AVL&红黑树简单介绍)
- 数据结构的简单学习6
- 数据结构学习三(一个简单的队列实现)
- C++简单学习(Part1_lecture 6)(时间、输入输出、数据结构)
- 数据结构的简单学习4
- Python中列表、字典、元组数据结构的简单学习笔记
- Java实现一部分简单的排序算法和数据结构(学习笔记20171022002)
- 数据结构学习笔记8——简单二叉树的实现与遍历
- Java基础课程学习总结,使用LinkedList简单模拟队列数据结构和堆栈数据结构的实现
- Python中列表、字典、元组数据结构的简单学习笔记
- 数据结构的简单学习2
- 数据结构学习中的简单问题(一):用链表方式实现的队列输出杨辉三角