题目内容 (请给出正确答案)
[主观题]

有以下程序: #include <stdio.h> #include <stdlib.h> int main() { int a=0,b=0,c=

有以下程序: #include <stdio.h> #include <stdlib.h> int main() { int a=0,b=0,c=0,d=0; if(a=1) b=1;c=2; else d=3; printf("%d,%d,%d,%d\n",a,b,c,d); system("pause"); return 0; }

A、0,1,2,0

B、0,0,0,3

C、1,1,2,0

D、编译有错

查看答案
如搜索结果不匹配,请 联系老师 获取答案
您可能会需要:
您的账号:,可能会需要:
您的账号:
发送账号密码至手机
发送
更多“有以下程序: #include <stdio.h> #inc…”相关的问题

第1题

有以下程序

#include<stdio.h>

#include<stdlib.h>

main( )

{int*a,*b,*c;

a=b=c=(int*)malloc(sizeof(int));

*a=1;*b=2,*c=3;

a=b

printf(”%d,%d,%d\n”,*a,*b,*c);

}

程序运行后的输出结果是( )。

A.3,3,3

B.2,2,3

C.1,2,3

D.1,1,3

点击查看答案

第2题

有以下程序: #include<stdio.h> #include<stdlib.h> main { int*a,*b,*C; a=b=c=(int*)malloc(sizeof(int)); *a=1;*b=2,*c=3; a=b: printf("%d,%d,%d\n",*a,*b,*c); } 程序运行后的输出结果是( )。

A.3,3,3

B.2,2,3

C.1,2,3

D.1,1,3

点击查看答案

第3题

有以下程序#include <stdio.h>#include <stdlib.h>int fun(int t){ int *p; p=(int*)malloc(sizeof(int)); *p=t; return *p;}main(){ int a; a = fun(8); printf("%d\n", a+fun(10));}程序的运行结果是A.0 B.10 C.18 D.出错

点击查看答案

第4题

有以下程序

#include <stdio.h>

#include <stdlib.h>

int fun(int n)

{ int *p;

p=(int*)malloc(sizeof(int));

*p=n; return *p;

}

main()

{ int a;

a = fun(10); printf("%d\n",a+fun(10));

}

程序的运行结果是

A)0

B)10

C)20

D) 出错

点击查看答案

第5题

include<stdio.h> include<stdlib.h> struct List { int data; struct List*next; }; typedef struct List node; typedef node*link; void main() { link ptr,head,tail; int num,i; tail=(link)malloc(sizeof(node)); tail一>next=(1): ptr=tail; printf("\nplease input data:\n"); for(i=0;i<=4;i++) { scanf("%d",(2)): ptr->data=num; head=(link)malloc(sizeof(node)); head一>next= (3) ; ptr=head; } ptr=(4) ; while(ptr!=NULL) { printf("the value is%d.\n",(5)); ptr=ptr一>next; } }

点击查看答案

第6题

#include <stdio.h>

#include <stdlib.h>

void getmemory(char *p)

{

p=(char *) malloc(100);

strcpy(p,"hello world");

}

int main( )

{

char *str=NULL;

getmemory(str);

printf("%s/n",str);

free(str);

return 0;

}

程序崩溃,getmemory中的malloc 不能返回动态内存, free()对str操作很危险

5.char szstr[10];

strcpy(szstr,"0123456789");

产生什么结果?为什么?

点击查看答案

第7题

以下程序: #include <stdio.h> #include <stdlib.h> main() { int *a,*b,*c; a=b=c=(int *)malloc(sizeof(int)); *a=1;*b=2,*c=3; a=b; printf("%d,%d,%d\n",*a,*b,*c); } 程序运行后的输出结果是(  )。

A、1,1,3

B、2,2,3

C、1,2,3

D、3,3,3

点击查看答案

第8题

# include <stdio.h> # include <stdlib.h> int main() { int len; int *p=NULL; len=5; p = (int *) malloc (sizeof(int)*len ); printf("%d\n",*(p+len-1)); free(p); return 0; }

A、0

B、2

C、4

D、以上都不对

点击查看答案

第9题

有以下程序: #define PI 3.14 #define R 5.0 #define S PI*R*R #include <stdio.h> #inclu
有以下程序: #define PI 3.14 #define R 5.0 #define S PI*R*R #include <stdio.h> #include <stdlib.h> int main() { printf("% f",S); system("pause"); return 0; } 该程序运行结果为( )。

A、3.14

B、78.500000

C、5.0

D、无结果

点击查看答案

第10题

以下程序运行过程中会出错,出错程序的行号()#include <stdio.h> #include <stdlib.h>
; fun(int *a,int *b) { int *w; *a=*a+*a; *w=*a; *a=*b; *b=*w; } int main() { int x=9,y=5,*px=&x,*py=&y; fun(px,py); printf("%d,%d\n",x,y); }

A、6

B、7

C、8

D、16

点击查看答案
热门考试 全部 >
相关试卷 全部 >
账号:
你好,尊敬的上学吧用户
发送账号至手机
密码将被重置
获取验证码
发送
温馨提示
该问题答案仅针对搜题卡用户开放,请点击购买搜题卡。
马上购买搜题卡
我已购买搜题卡, 登录账号 继续查看答案
重置密码
确认修改
谢谢您的反馈

您认为本题答案有误,我们将认真、仔细核查,
如果您知道正确答案,欢迎您来纠错

警告:系统检测到您的账号存在安全风险

为了保护您的账号安全,请在“上学吧”公众号进行验证,点击“官网服务”-“账号验证”后输入验证码“”完成验证,验证成功后方可继续查看答案!

微信搜一搜
上学吧
点击打开微信
警告:系统检测到您的账号存在安全风险
抱歉,您的账号因涉嫌违反上学吧购买须知被冻结。您可在“上学吧”微信公众号中的“官网服务”-“账号解封申请”申请解封,或联系客服
微信搜一搜
上学吧
点击打开微信