#include <stdio.h>
#include <stdlib.h> struct student{
int num;
char str[];
double dec;
}; void scan(struct student stu[], int *n){
scanf("%d", n);
for(int i = ; i < *n; ++i){
scanf("%d%s%lf", &stu[i].num, stu[i].str, &stu[i].dec);
}
} void print(struct student stu[], int n){
printf("%d\n", n);
for(int i = ; i < n; ++i){
printf("%d %s %lf\n", stu[i].num, stu[i].str, stu[i].dec);
}
} int main(){
int n;
struct student stu[]; scan(stu, &n);
print(stu, n); return ;
}
/*
3
20 字符串0 20.02
21 字符串1 21.12
22 字符串2 22.22
*/

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

  1. C语言结构体及函数传递数组參数演示样例

    注:makeSphere()函数返回Sphere结构体,main函数中.调用makeSphere()函数,传递的第一个參数为数组,传递的数组作为指针.

  2. C#和C++互相操作 结构体数组的传递

    C++中结构体定义: typedef struct // 平面 { double time;  float normal[3]; float center[3];  } plane; C++中方法声明 ...

  3. C/C++ 结构体 指针 函数传递

    #include <stdio.h> #include <stdlib.h> struct student{ int num; ]; double dec; }; void s ...

  4. C#调用C/C++动态库 封送结构体,结构体数组

    一. 结构体的传递 #define JNAAPI extern "C" __declspec(dllexport) // C方式导出函数 typedef struct { int ...

  5. C#调用C/C++动态库 封送结构体,结构体数组

    因为实验室图像处理的算法都是在OpenCV下写的,还有就是导航的算法也是用C++写的,然后界面部分要求在C#下写,所以不管是Socket通信,还是调用OpenCV的DLL模块,都设计到了C#和C++数 ...

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

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

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

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

  8. 【C++】结构体/结构体数组/结构体指针/结构体嵌套/函数参数/const

    一.结构体声明 struct Student { //成员列表 string name; int age; int score; }; //s3;定义时直接声明 int main() { struct ...

  9. go语言基础之结构体做函数参数 值传递和地址传递

    1.结构体做函数参数值传递 示例: package main //必须有个main包 import "fmt" //定义一个结构体类型 type Student struct { ...

随机推荐

  1. 首师大附中互测题:50229234海岛帝国:独立之战【C002】

    [C002]50229234海岛帝国:独立之战[难度C]———————————————————————————————————————————————————————————————————————— ...

  2. 2016-2017 ACM-ICPC, NEERC, Northern Subregional Contest

    A. Anniversary Cake 随便挑两个点切掉就好了. #include<bits/stdc++.h> using namespace std; const int Maxn=2 ...

  3. python中文注释报错问题

    错误信息: SyntaxError: Non-ASCII character '\xe4' in file... 解决办法: 在文件第一行或第二行添加:# -*- coding: utf-8 -*- ...

  4. Python In Action:三、再来一个扩展例子,保证不难

    在窗口显示一张图片,代码如下: import wx class Frame(wx.Frame): """Frame class that displays an imag ...

  5. 使用BigDecimal进行精确运算以及格式化输出数字

    一.引言    借用<Effactive Java>这本书中的话,float和double类型的主要设计目标是为了科学计算和工程计算.他们执行二进制浮点运算,这是为了在广域数值范围上提供 ...

  6. C# 内嵌其他程序到自己程序

    写一xxx聊天机器人啊什么的可能会用到这种技术.比如把QQ窗体嵌入自己的winform中其实很简单,调用两个API函数即可. [DllImport("User32.dll ", E ...

  7. HDU 5833 Zhu and 772002(高斯消元)

    题意:给n个数,从n个数中抽取x(x>=1)个数,这x个数相乘为完全平方数,求一共有多少种取法,结果模1000000007. 思路:每个数可以拆成素数相乘的形式,例如: x1 2=2^1 * 3 ...

  8. 【转】ACM博弈知识汇总

    博弈知识汇总 转自:http://www.cnblogs.com/kuangbin/archive/2011/08/28/2156426.html 有一种很有意思的游戏,就是有物体若干堆,可以是火柴棍 ...

  9. svn bug

    Error:Can't find temporary directory:internal error 原因:服务器端,磁盘满了 repository and is not part of the c ...

  10. struts2上传图片的全过程

    struts2上传图片的过程 1.写一个上传的jsp页面upload_image.jsp,内容如下:<body><center>    <font color=" ...