以下程序执行后的输出结果是#include struct STU{ char name[10]; int num;};void Fun1(struct STU c){ struct STU b={LiGuo,2042}; c=b;};int main(){ struct STU a={YangHan,2041},b={WangYi,2043}; Fun1(a); printf(%d %d
,a.num,b.num); return 0;}
,a.num,b.num); return 0;}
举一反三
- 中国大学MOOC: 写出下面程序执行后的运行结果。#include <stdio.h>struct STU {char name[10]; int num;};void f1(struct STU c){struct STU b={"LiSiGuo",2042};c=b;}void f2(struct STU *c){struct STU b={"SunDan",2044};*c=b;}int main( ){struct STU a={"YangSan",2041},b={"WangYin",2043};f1(a); f2(&b) ;printf("%d %d",a.num,b.num); return 0;}
- 以下结构体的定义语句中,正确的是______。? struct student {int num; char name[10];int age;}stu;|struct {int num; char name[10];int age;}student; struct student stu;|struct student {int num; char name[10]; int age;}; student stu;|struct student {int num; char name[10];int age;};stu;
- 有以下程序段,输出结果为()。 #include<stdio.h> struct student {int num; char name[20]; float score; }; main() {struct student stu[5]; printf("%d",sizeof(stu)); }
- 对结构体类型变量定义不正确的是( )。 A: B: define STUDENT struct studentSTUDENT{char name;int num;}std; C: struct student{char name;int num;}stu; D: E: define struct student{char name;int num;}STD;STD stu; F: struct{char name;int num;}student;struct student stu;
- 根据程序,请判断输出结果:#include<stdio.h>struct stu{int num;char name[5];int age;char sex;};void fun(struct stu *p){printf("%s\n",(*p).name);}main(){struct stu stud[3]={{0001,"zhang",20,'f'},{0002,"li",18,'m'},{0003,"chen",19,'f'}};fun(stud+2);}