网友您好, 请在下方输入框内输入要搜索的题目:

题目内容 (请给出正确答案)

有以下程序: struct STU { char name[10]; int num; float TotalScore; }; void f(struct STU *p) { struct STU s[2]={{"SunDan", 20044, 550}, {"Penghua", 20045, 537}}, *q=s; ++p; ++q; *p=*q; } main() { struct STU s[3]={{"YangSan", 20041, 703}, {"LiSiGuo", 20042, 580}}; f(s); printf(" % s % d % 3.0f\n", s[1]. name, s[1]. num, s[1]. TotalScore); } 程序运行后的输出结果是______。

A.SunDan 20044 580

B.Penghua 20045 537

C.LiSiGUO 20042 580

D.SunDan 20041 703


参考答案

更多 “ 有以下程序: struct STU { char name[10]; int num; float TotalScore; }; void f(struct STU *p) { struct STU s[2]={{"SunDan", 20044, 550}, {"Penghua", 20045, 537}}, *q=s; ++p; ++q; *p=*q; } main() { struct STU s[3]={{"YangSan", 20041, 703}, {"LiSiGuo", 20042, 580}}; f(s); printf(" % s % d % 3.0f\n", s[1]. name, s[1]. num, s[1]. TotalScore); } 程序运行后的输出结果是______。A.SunDan 20044 580B.Penghua 20045 537C.LiSiGUO 20042 580D.SunDan 20041 703 ” 相关考题
考题 有以下程序includestruct STU{char name[10];int num;};void f(char*name, intnum){s 有以下程序 #include <string.h> struct STU { char name[10]; int num; }; void f(char *name, int num) { struct STU s[2]={{"SunDan",20044},{"Penghua",20045}}; num=s[0].num; strcpy(name,s[0].name); } main() { struct STU s[2]={{"YangSan",20041},{"LiSiGuo",20042}},*p; p=s[1]; f(p->name,p->num); printf("%s %d\n",p->name,p->num); } 程序运行后的输出结果是A.SunDan 20042B.SunDan 20044C.LiSiGuo 20042D.YangSan 20041

考题 有以下程序: include struct STU (char name[10]; int num; }; 有以下程序: #include <string.h> struct STU (char name[10]; int num; }; void f(char *name, int num) {struct STU s[2]={{"SunDan",20044}.{"Penghua",20045}}; num=s[0].num; strcpy(name,s[0].name); } main() {struct STU s[2]={{"YangSall",20041},{"LiSiGao",20042}},*p;p=s[1]; f(p->name,p->num); printf("%s%d\n",p->name,p->num); } 程序运行后的输出结果是 ______。A.SunDan 20042B.SunDan 20044C.LiSiGuo 20042D.YangSan 20041

考题 void setmemory(char **p, int num){ *p=(char *) malloc(num);}void test(void){ char *str=NULL;getmemory(str,100);strcpy(str,"hello");printf(str);}运行test函数有什么结果?( )

考题 Void GetMemory2(char **p, int num){*p = (char *)malloc(num);}voidTest(void){char *str = NULL;GetMemory(str, 100);strcpy(str, "hello"); printf(str); }请问运行Test 函数会有什么样的结果?

考题 下面的程序各自独立,请问执行下面的四个TestMemory 函数各有什么样的结果?①void GetMemory(char * p){p = (char * )malloc(100);}void TestMemory (void){char *str = NULL;GetMemory (str);strcpy(str, "hello world");prinff(str);}② char * GetMemory (void){char p[ ] = "hello world";return p;}void TestMemory (void){char * str = NULL;str = GetMemory( );printf(str);}③void GetMemory(char * * p, int num){* p = (char * )malloc(num);}void TestMemory (void){char * str = NULL;GetMemory(str, 100);strcpy( str, "hello" );printf(sir);}④void TestMemory (void){char *str = (char * )malloe(100);strepy (str, "hello" );free ( str );if(str ! = NULL){strepy( str, "world" );printf(str);}}

考题 若能使程序运行后的输出结果如下: 201501 201502 201503 则空白处填写的表达式或语句应该是 #include <stdio.h> struct student { int age; char num[8]; }; int main() { struct student stu[3]={{20,"201501"},{21,"201502"},{19,"201503"}}; struct student *p=stu; ____________________ return 0; }A.printf("%sn",(*p).num); printf("%sn",(p)->num); printf("%sn",stu[2].num);B.printf("%sn",(p++).num); printf("%sn",(p++).num); printf("%sn",(p++).num);C.printf("%sn",(p)->num); printf("%sn",(p)->num); printf("%sn",(*p).num);D.printf("%sn",stu[0]->num); printf("%sn",stu[1]->num); printf("%sn",stu[2]->num);

考题 设有以下结构体定义及初始化,表达式p->score的结果是()。 struct node { int num; float score; }stu[2]={101,91.5,102,92.5},*p=stu; A)101 B)91.5 C)102 D)92.5A.分析错误#B.该定义使stu[0].num=101,stu[0].score=91.5,stu[1].num=102,stu[0].score=92.5,p指向数组stu的首地址,p->score的值是stu[0].score。#C.分析错误#D.分析错误

考题 【单选题】以下结构体的定义语句中,正确的是______。A.struct student {intnum; char name[10];int age;};stu;B.struct {int num;char name[10];int age;}student; struct studentstu;C.struct student {int num; char name[10];int age;}stu;D.struct student {int num; char name[10]; int age;}; student stu;

考题 7、若能使程序运行后的输出结果如下: 201501 201502 201503 则空白处填写的表达式或语句应该是 #include <stdio.h> struct student { int age; char num[8]; }; int main() { struct student stu[3]={{20,"201501"},{21,"201502"},{19,"201503"}}; struct student *p=stu; ____________________ return 0; }A.printf("%s\n",(*p).num); printf("%s\n",(p)->num); printf("%s\n",stu[2].num);B.printf("%s\n",(p++).num); printf("%s\n",(p++).num); printf("%s\n",(p++).num);C.printf("%s\n",(p)->num); printf("%s\n",(p)->num); printf("%s\n",(*p).num);D.printf("%s\n",stu[0]->num); printf("%s\n",stu[1]->num); p

考题 以下结构体的定义语句中,正确的是______。A.struct student {int num; char name[10];int age;};stu;B.struct {int num; char name[10];int age;}student; struct student stu;C.struct student {int num; char name[10];int age;}stu;D.struct student {int num; char name[10]; int age;}; student stu;