#include <stdio.h>
#include <stdlib.h>
#include <string.h>
#include <stdbool.h>
#define SIZE 5 typedef struct _student{
char *name;
int age;
short id;
double record;
} Student; Student *initStudent(){
Student *ptrStu = (Student *)malloc(sizeof(Student));
ptrStu->name = (char *)malloc(sizeof(char) * );
printf("please input student info: ");
printf("\nname: ");
scanf("%s", ptrStu->name);
printf("age: ");
scanf("%d", &ptrStu->age);
printf("id: ");
scanf("%d", &ptrStu->id);
printf("record: ");
scanf("%f", &ptrStu->record); return ptrStu;
} void displayStudent(Student *ptrStu){
printf("The student %s's info: \n", ptrStu->name);
printf("name: %s\n", ptrStu->name);
printf("age: %d\n", ptrStu->age);
printf("id: %d\n", ptrStu->id);
printf("record: %f\n", ptrStu->record);
printf("\n"); return;
} int main(int argc, char **argv)
{
Student *arrStu[SIZE];
for(int i = ; i < SIZE; i++){
arrStu[i] = initStudent();
}
for(int i = ; i < SIZE; i++){
displayStudent(arrStu[i]);
} return ;
}

struct init的更多相关文章

  1. C# 9.0新特性详解系列之一:只初始化设置器(init only setter)

    1.背景与动机 自C#1.0版本以来,我们要定义一个不可变数据类型的基本做法就是:先声明字段为readonly,再声明只包含get访问器的属性.例子如下: struct Point { public ...

  2. linux kernel 结构体赋值方法{转载}

    原文地址: http://www.chineselinuxuniversity.net/articles/48226.shtml 这几天看Linux的内核源码,突然看到init_pid_ns这个结构体 ...

  3. golang常见错误

    import import unuse package: error : imported and not used: "os" := = c := 1 // error non- ...

  4. 深入理解C++11

    [深入理解C++11] 1.很多 现实 的 编译器 都 支持 C99 标准 中的__ func__ 预定 义 标识符 功能, 其 基本 功能 就是 返回 所在 函数 的 名字. 编译器 会 隐式 地 ...

  5. Hyperledger Fabric链码之二

    上篇文章中我们介绍了链码的概念,本文中我们将介绍Fabric下链码的编写和测试.我们会通过一个简单例子的方式来阐述链码API的使用. 链码API     每一个链码程序都必须实现一个接口Chainco ...

  6. (转)fabric 一个链码如何调用另一个链码

    使用开发模式测试 可以使用~/hyfa/fabric-samples/chaincode-docker-devmode/启动fabric,具体过程略 用同一个链码注册2个服务 root@2ee7b51 ...

  7. 【BZOJ】2561: 最小生成树【网络流】【最小割】

    2561: 最小生成树 Time Limit: 10 Sec  Memory Limit: 128 MBSubmit: 2685  Solved: 1253[Submit][Status][Discu ...

  8. 让你看不懂的swift语法

    一.Swift杂谈 Swift语法出来时间不长,网络上的各种教程已经铺天盖地,可是基本上全部的教程都是来自官方翻译. 从Swift出来到如今.每天都在学习Swift.以下给出个人感受 Swift中的非 ...

  9. HyberLedger Fabric学习(3)-chaincode学习(开发者)

    参考:http://hyperledger-fabric.readthedocs.io/en/latest/chaincode4ade.html chaincode是由go语言写的,实现了定义的接口. ...

随机推荐

  1. spring常用注解笔记

    spring常用注解解释: 1. Mybatis的映射文件xxxMapper.xml中resultMap标签的作用 resultMap标签是为了映射select查询出来结果的集合,其主要 作用是将实体 ...

  2. hihocoder offer收割编程练习赛11 D 排队接水

    思路: 莫队算法+树状数组. 莫队算法的基本思想是对大量要查询的区间进行离线处理,按照一定的顺序计算,来降低复杂度.概括来说,我们在知道了[l, r]的解,并且可以通过一个较低的复杂度推出[l - 1 ...

  3. 2.3点击菜单显示div再点击就隐藏

    事件:onclick 属性:display 利用if语句实现 <!DOCTYPE html><html><head><meta charset="u ...

  4. 【CSS】3种CSS方法设置元素垂直水平居中

    1. 宽高固定 设置要水平垂直居中的 div 的 position 为 absolute,left:50%; margin-left为负的这个元素宽度的一半,同理,top:50%;margin-top ...

  5. jQuery实现复选框的全选与全不选

    对于复选框的选中checked属性,实在是无力吐槽. 从上图可以看出,当复选框不设置checked属性时,默认没有被选中:其它三种情况,设置checked属性但不设置属性值即置空,或者将checked ...

  6. Eclipse打包多渠道包

    下面介绍的是在eclipse中使用gradle进行多渠道打包(添加签名+混淆) 1,首先新建一个android测试项目,结构如下图所示: 2,选中右键选择expert->生成gradle文件,如 ...

  7. iOS :Object-C 语言merge两个字典对象

    Object-C 语言merge两个字典对象 - (id)mutableDictionaryCopyIfNeeded:(id)dictObj { if ([dictObj isKindOfClass: ...

  8. PHP 中 include() 与 require() 的区别说明

    引用文件的方法有两种:require 及 include.两种方式提供不同的使用弹性. require 的使用方法如 require("MyRequireFile.php"); . ...

  9. Axure 9 面板折叠显示隐藏

    1  首先放置一个面板1作为点击事件: 2  另外一个面板2或者其他组建,将其设置为动态面板,然后隐藏 3  给面板1添加如下事件,即可: 4  我们点击面板1,可以实现展开隐藏面板2的动态效果

  10. secureCRT 破解

    转自:http://www.cnblogs.com/qingtingzhe/articles/5008902.html