#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. js对象数组深度去重和深度排序

    使用collect.js处理数组和对象 https://github.com/ecrmnn/collect.js/# 引入collect.js https://github.com/ecrmnn/co ...

  2. CCF|路径解析|Java

    import java.util.Scanner; public class Main { public static void main(String[] args) { Scanner in=ne ...

  3. EcliplseJPA2.1和glassfish3.1兼容问题

    之前一个项目,持久层用eclipseJpa2.1实现,web服务器用的是glassfish3.1. 部署完成后测试的时候出现bug,反反复复折腾了n次,最终确认是版本兼容的问题. 或者用glassfi ...

  4. idea 一些设置

    idea  中编码格式:VM options 中输入:-Dfile.Encoding=UTF-8    添加tomcat  当+号中没有tomcat时,先看有没有tomcat插件,没有则进行添加,然后 ...

  5. vue动态加载组件

    vue动态加载组件,可以使用以下方式 <component :is="propertyname" v-for="tab in tabs"></ ...

  6. CAD使用SetxDataString写数据(com接口)

    主要用到函数说明: MxDrawEntity::SetxDataString 写一个字符串扩展数据,详细说明如下: 参数 说明 [in] BSTR val 字符串值 szAppName 扩展数据名称 ...

  7. F. Asya And Kittens并查集

    F. Asya And Kittens time limit per test 2 seconds memory limit per test 256 megabytes input standard ...

  8. Java中List集合的遍历

    一.对List的遍历有三种方式 List<String> list = new ArrayList<String>(); list.add("testone" ...

  9. socket编程(Java实现)

    主要是前段时间学习的网络知识的基于TCP与UDP编程,Java实现简单的大小写字母的转化,该文主要参考: https://blog.csdn.net/yjp19871013/article/detai ...

  10. ORA-28000: the account is locked-详细解决方案

    运行-->cmd-->sqlplus /nolog conn system/orcl(或预设的密码) alter user scott identified by tiger(或预设密码) ...