#include <stdio.h>
#include <stdlib.h> struct student{
int num;
char str[];
double dec;
}; void scan(struct student *stu){
// scanf("%d%s%lf", &stu->num, stu->str, &stu->dec);
scanf("%d%s%lf", &(*stu).num, (*stu).str, &(*stu).dec);//.运算符优先级大于*
} void print(struct student stu){
printf("%d %s %lf\n", stu.num, stu.str, stu.dec);
} int main(){ struct student stu; scan(&stu);
print(stu); return ;
}
/*
20 字符串 20.02
*/

C/C++ 结构体 函数传递的更多相关文章

  1. C的结构体函数

    #include<stdio.h> #include<string.h> struct Test { int age; ]; double score; }std1; //结构 ...

  2. shell的编程结构体(函数、条件结构、循环结构)

    bash&shell系列文章:http://www.cnblogs.com/f-ck-need-u/p/7048359.html 1.1 shell函数 在shell中,函数可以被当作命令一样 ...

  3. Swift基础(类,结构体,函数)

    import Foundation // 创建一个类 class Student { // 属性(类的属性必须赋初值,如果不赋值,需要写自定义方法) var studentName: String v ...

  4. c 结构体 & 函数指针模拟实现一个java class(类) 和方法

    闲来无事,纯粹练习. student.h #ifndef STUDENT_H_INCLUDED #define STUDENT_H_INCLUDED #include <memory.h> ...

  5. go 结构体函数

    package main import "fmt" type Dog struct { Name string } func (d *Dog) speak() string { r ...

  6. go 函数传递结构体

    我定义了一个结构体,想要在函数中改变结构体的值,记录一下,以防忘记 ep: type Matrix struct{ rowlen int columnlen int list []int } 这是一个 ...

  7. 菜鸟学习-C语言函数参数传递详解-结构体与数组 分类: C/C++ Nginx 2015-07-14 10:24 89人阅读 评论(0) 收藏

    C语言中结构体作为函数参数,有两种方式:传值和传址. 1.传值时结构体参数会被拷贝一份,在函数体内修改结构体参数成员的值实际上是修改调用参数的一个临时拷贝的成员的值,这不会影响到调用参数.在这种情况下 ...

  8. C#调用C++DLL传递结构体数组的终极解决方案

    在项目开发时,要调用C++封装的DLL,普通的类型C#上一般都对应,只要用DllImport传入从DLL中引入函数就可以了.但是当传递的是结构体.结构体数组或者结构体指针的时候,就会发现C#上没有类型 ...

  9. 绝对好文C#调用C++DLL传递结构体数组的终极解决方案

    C#调用C++DLL传递结构体数组的终极解决方案 时间 2013-09-17 18:40:56 CSDN博客相似文章 (0) 原文  http://blog.csdn.net/xxdddail/art ...

随机推荐

  1. 【bzoj3160】万径人踪灭 FFT

    题目:http://www.lydsy.com/JudgeOnline/problem.php?id=3160 我是一个傻叉 微笑脸 #include<bits/stdc++.h> #de ...

  2. UICollectionView集合视图的概念

    如何创建UICollectionView 集合视图的布局UICollectionViewFlowLayout 自定义cell 布局协议UICollectionViewDelegateFlowLayou ...

  3. SQL Server 插入数据后获得自增主键值

    通过SQLServer系统自带函数获取 String sql = "insert into goods values('" + TextBox1.Text + "',&q ...

  4. GridView合并表头、多重表头(转)

    protected void GridView1_RowCreated(object sender, GridViewRowEventArgs e) { switch (e.Row.RowType) ...

  5. android-BaseAdapter自定义控件深刻理解

    一.自定义控件的实现 自定义控件需要继承BaseAdapter抽象类,该类实现了ListAdapter, SpinnerAdapter两个接口,这两个接口继承了Adapter接口类,没错.是继承Ada ...

  6. 获取Android studio的SHA1值

    D:\Android\BaiduMapsApiASDemo>c: C:\>cd .android 系统找不到指定的路径. C:\>cd Users C:\Users>cd Ad ...

  7. ZK dropEvent简单使用

    前台(Drop.zul) <?page title="拖动测试" contentType="text/html;charset=UTF-8"?> & ...

  8. ssh框架开发问题

    Struts + spring MVC + hibernate   6.1   从职责上分为表示层.业务逻辑层.数据持久层和域模块层四层. 其中使用Struts作为系统的整体基础架构,负责MVC的分离 ...

  9. E-Dijkstal

    1005 输出用%f,1009别做了 Problem E Time Limit : 2000/1000ms (Java/Other)   Memory Limit : 32768/32768K (Ja ...

  10. 整数与IP地址间的转换

    描述 原理:ip地址的每段可以看成是一个0-255的整数,把每段拆分成一个二进制形式组合起来,然后把这个二进制数转变成一个长整数.举例:一个ip地址为10.0.3.193每段数字            ...