zoukankan      html  css  js  c++  java
  • C/C++ 结构体 函数传递

     1 #include <stdio.h>
     2 #include <stdlib.h>
     3 
     4 struct student{
     5     int num;
     6     char str[20];
     7     double dec;
     8 };
     9 
    10 void scan(struct student *stu){
    11 //    scanf("%d%s%lf", &stu->num, stu->str, &stu->dec);
    12     scanf("%d%s%lf", &(*stu).num, (*stu).str, &(*stu).dec);//.运算符优先级大于*
    13 }
    14 
    15 void print(struct student stu){
    16     printf("%d %s %lf
    ", stu.num, stu.str, stu.dec);
    17 }
    18 
    19 int main(){
    20 
    21     struct student stu;
    22     
    23     scan(&stu);
    24     print(stu);
    25 
    26     return 0;
    27 }
    28 /*
    29 20 字符串 20.02
    30 */
  • 相关阅读:
    RSA加密系统
    安装homebrew
    go helloworld
    下载文件checksum
    6月3日
    6月1日
    5月30日
    5月28日
    5月26日
    5月24日
  • 原文地址:https://www.cnblogs.com/xuqiulin/p/6158946.html
Copyright © 2011-2022 走看看