结构类型指针变量的使用实例
来源:互联网 发布:ie浏览器 for mac下载 编辑:程序博客网 时间:2024/05/22 11:34
#include <stdio.h>#include <stdlib.h>#include <string.h>int main(void){struct DateType{int year;int month;int day;};struct StudentType{int num;char *name;char sex[3];struct DateType birthday;float score;};struct StudentType student;struct StudentType *pStudent;pStudent=&student;(*pStudent).num=10101;(*pStudent).name="µÂ»ªÁõ";strcpy((*pStudent).sex,"ÄÐ");(*pStudent).birthday.year=1962;(*pStudent).birthday.month=8;(*pStudent).birthday.day=18;(*pStudent).score=98.1;printf("ѧºÅ:%d\n",pStudent->num);printf("ÐÕÃû:%s\n",pStudent->name);printf("ÐÔ±ð:%s\n",pStudent->sex);printf("ÉúÈÕ:%dÄê,%dÔÂ,%dÈÕ\n",pStudent->birthday.year,pStudent->birthday.month,pStudent->birthday.day);printf("³É¼¨:%4.1lf\n",pStudent->score);system("PAUSE");return 0;}在c语言中,pStudent—>num与(*pStudent).num等价,但是前者更加直观,希望读者多使用前者
0 0
- 结构类型指针变量的使用实例
- 指向结构类型变量的指针
- 结构体struct的应用、结构体变量、结构体指针变量、结构体指针变量类型的区别
- 结构体变量、结构指针变量、结构数组作为函数的参数应用实例分析
- 结构体变量、结构指针变量、结构数组作为函数的参数应用实例分析
- 结构体变量、结构指针变量、结构数组作为函数的参数应用实例分析
- 结构体变量、结构指针变量、结构数组作为函数的参数应用实例分析 .
- 结构体变量、结构指针变量、结构数组作为函数的参数应用实例分析
- 指向结构体类型变量的使用
- 【C语言经典实例】-指向结构体的指针变量
- 结构体指针变量使用时的注意事项
- //结构指针变量的声名和使用示例
- 结构体指针变量使用时的注意事项
- 结构的指针变量名
- 指向结构变量的指针
- 指向结构变量的指针
- 结构体变量的指针
- 使用变量或者结构体与使用变量指针或结构体指针方法的优缺点是
- Admob(6.12.x)符号未定义错误的解决方法(IOS)
- 题目1069:查找学生信息
- Linux磁盘存储入门
- 发帖骨头个人结果让他几乎覆盖
- 电容的作用详解
- 结构类型指针变量的使用实例
- Hibernate主键注解
- mysql hibernate 关于默认值
- /bin/bash^M: bad interpreter: No such file or directory
- 黑马程序员-入学前的日记1
- 紐巴倫專賣 LkNK 7ct sLGFy
- FFmpeg源代码简单分析:avformat_alloc_output_context2()
- Gnu Linux命令行修改IP、网关、DNS的方法
- Leetcode Populating Next Right Pointers in Each Node