c语言结构体问题

[复制链接]
查看11 | 回复0 | 2010-6-27 14:48:34 | 显示全部楼层 |阅读模式
定义一个结构体变量
struct stu{

int num;

float a[5];
}student[3];
能否在main函数中用循环对其赋值呢?

int i,j;

for(i=0;i#include struct stu{
int num;
float a[5];}student[3];int main(int argc, char *argv[]){
int i,j;
for(i=0;i<3;i++)
{
for(j=0;j<5;j++)
{
scanf("%f",&student.a[j]);
回复

使用道具 举报

您需要登录后才可以回帖 登录 | 立即注册

本版积分规则

主题

0

回帖

4882万

积分

论坛元老

Rank: 8Rank: 8

积分
48824836
热门排行