首页/ 题库 / [单选题]根据下列的定义,能打印出字母P的语句是(的答案

根据下列的定义,能打印出字母P的语句是( )。 struct stu { char name[10]; iht age; }; struct stu s[10]={"John",11, "Paul", 12, "Mary", 11, "adam",12 };

单选题
2022-07-11 08:04
A、printf("%c",s[3].name);
B、printf("%c",s[3].name[1]);
C、printf("%c",s[2].name[1]);
D、printf("%c",s[1].name[0]);
查看答案

正确答案
D

试题解析
解析:本题主要考查按结构数组元素方式引用结构成员。字母P为“Paul”的第一个字母,是结构体s[1]的name成员的第一个元素的值,即s[1].name[0]的值。

标签:
感兴趣题目
根据下列的定义,能打印出字母P的语句是( )。 struct stu {char name[10]; int age; }; struct sm s[10]={"John",11, "Pau1",12, "Mary",11, "adam",12 };
根据下列的定义,能打印出字母P的语句是( )。 struct stu { char name[10]; iht age; }; struct stu s[10]={"John",11, "Paul", 12, "Mary", 11, "adam",12 };
设有以下语句: struct SS { int no; char name[10];}PERSON; 则下面叙述中错误的是 ( )
有如下定义struct person {char name[9];int age;};struct person class[10]={"John",17,"paul",19,"Mary",18,"Adam",16,};根据上述定义,能输出字母M的语句是
有如下定义: struct person {char name[9];int age;}; struct person class[10]={"John",17,"paul",19,"Mary",18,"Adam",16}; 根据上述定义,能输出字母M的语句是( )。
有如下定义struct person{char name[9];int age;};struct person class[10]={"John",17,"paul",19,"Mary",18,"Adam",16,};根据上述定义,能输出字母M的语句是
有以下说明和定义语句 struct student { int age; char num[8];}; struct student stu[3]={{20,"200401"},{21,"200402"},(19,"200403"}}; struct student*p=stu; 以下选项中引用结构体变量成员的表达式错误的是______。
有以下说明和定义语句struct student{ int age;char num {8};};struct student stu[3]={{20,“200401”},{21,“200402”),{19,“200403”}};struct student *p=stu; 以下选项中引用结构体变量成员的表达式错误的是
有以下说明和定义语句:struct student{int age; char num[8] ;};struct student stu [3] = { { 20, "200401" } , {21, "200402" } , {19, "200403" } };stract student * p = stu;以下选项中引用结构体变量成员的表达错误的是( )。
有以下说明和定义语句 struct student { int age;char num[8]; struct student stu[3]={{20,"200401"},{21,"200402"},{19,"200403"}}; struct student *p=stu;}; 以下选项中引用结构体变量成员的表达式错误的是
有以下说明和定义语句 struct student {int age;char num[8]; }; struct student stu[3]={{20,"200401"},{21,"200402"},{109,"200403"}}; struct student*p=stu;以下选项中引用结构体变量成员的表达式错误的是______。
若有以下定义的语句 struct student {int age; int num;}; struct student stu[3]={{1001,20},{1002,19},{1003,21}}; main() {stmct student *p; p=stu; …} 则以下不正确的引用是
相关题目
设有如下定义,下面输入语句中,( )错误。struct ss { char name[10];int age;char sex;}std[3],p=std;
有如下定义:struct person{char name[9]; int age;};struct person class[10]={“Johu”, 17,“Paul”, 19,“Mary”, 18,“Adam 16,};根据上述定义,能输出字母M的语句是 ( )
设struct{char name[10];int age;}stu[2]={{ ″Tom″,25},{″Mary″,26}},p=stu;则执行语句printf(″%s%d\n″,p->name,stu[1]age);后输出结果是( )
若有以下定义: struct tt{char name[10];char sex;}aa={"aaaa",′F′},*p=&aa; 则错误的语句是( )。选项格式:scanf("%c",a选项格式:sex);a选项格式:
某C语言结构体的定义如下。 struct date { int year, month, day; }; struct worklist { char name[20]; char sex; struct date birthday; }person; 若对变量person的出生年份进行赋值,正确的赋值语句是(33)。
有以下程序 #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 ",p->name,p->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 ",p->name,p->num); } 程序运行后的输出结果是 ______。
有以下程序:#include <stdio.h>#include <strine.h> struct STU { char name[10]; int hum;};void f(char * name,iht num){ struct STU s[2] = {{ "SunDan" ,20044} , {" Penghua" ,20045}}; num= s[0]. nnm; strepy(name,s[0], name);}main( ){ struct STU s[2] = {{"YangSan" ,20041 }, { "LiSiGao" ,20042}}, * P; p = &s[1]; f(p->name,p->hum); printf("% s %d " ,p-> name,p->num);}程序运行后的输出结果是( )。
定义下列结构体(联合)数组: struct st { char name[15]; int age; }a[10]={"ZHAO",14, "WANG",15, "LIU",16, "ZHANG",17 }; 执行语句printf["%d,%c",a[2].age, *(a[3].name+2))的输出结果为( )。
定义下列结构体(联合)数组: struct St { char name[15]; int age; }a[10]={"ZHAO",14,"WANG",15,"LIU",16,"ZHANG",17}; 执行语句printf("%d,%c",a[2].age,*(a[3].name+2))的输出结果为( )。
定义下列结构体(联合)数组:struct st{ char name[15]; int age;}a[10]={"ZHAO",14,"WANG",15,"LIU",16,"ZHANG",17};执行语句printf("%d,%c",a[2].age,*(a[3].name+2))的输出结果为( )。
有以下程序: #include<stdio.h> struct stu { int num;char name[l0];int age;}; void fun(struct stu*p) { printf("%s ",p->name);} main( ) { struct stu x[3]={{01,"Zhang",20),{02,"Wang",l9},{03,"Zha0",l8}}; fun(x+2); } 程序运行后的输出结果是( )。
以下程序的输出结果是______。#include<stdio.h>struct stu{ int num; char name[10]; int age;};void fun(struct stu*p){ printf("%s ",(*p).name);}main(){ struct stu students[3]={ {9801,"Zhang",20}, { 9802,"Wang",19}, { 9803,"Zhao",18} }; fun(students+2);}
有以下程序: #include<<stdio.h> struct stu { int num; char name[10]: int age;} void fun(struct stu*p) {printf("%s\n",(*p).name);} the main { struct stu students[3]={{9801,"Zhang".20}, {9802,"Wang",19},{9803,"Zhao",1 8}} fun(students+2); } 输出的结果是( )。
若有下列说明和语句,则对结构体变量st中成员i的引用方式不正确的是( )。 Struct stu { int i; int name; }st,*p; p=&st;
若有下列说明和语句,则对结构体变量st中成员i的引用方式不正确的是( )。Struct stu{ int i;int name;}st,*p;p=&St;
有以下说明语句:struct Worker{int no;char name[20];};Worker w,*p=&w;则下列错误的引用是()
有以下程序 struct STU { char name[10]; int num; float TotalScore; }; vold f(struct STU *p) { struct STU s[2]={{"SunDan",20044,550),{"Penghua".20045,537}},*q=s ++p; ++q; *p=*q; } main() { struct SrU s[3]={{"YangSan",20041,703),{"LiSiGuo",20042,580}}; f(s); printf("%s %d %3.of ",S[1].name,s[1].num,s[1].Totalscore); } 程序运行后的输出结果是
有以下程序: 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 ",s[1].name,s[1].num,s[1].TotalScore); } 程序运行后的输出结果是 ______。
有以下程序: 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 ", s[1]. name, s[1]. num, s[1]. TotalScore); } 程序运行后的输出结果是______。
广告位招租WX:84302438

免费的网站请分享给朋友吧