[单选题]

有以下程序

#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.) 出错

参考答案与解析:

相关试题

有以下程序#include <stdio.h>#include <stdlib.

[单选题]有以下程序#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.出错

  • 查看答案
  • 有以下程序#include<stdio.h>#include<stdlib.h>

    [单选题]有以下程序#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=bprintf(”%d,%d,%d\n”,*a,*b,*c);}程序运行后的输出结果是( )。A.3,3,3B.2,2,3C.1,2,3D.1,1,3

  • 查看答案
  • 有以下程序<br />#include <stdio.h><br />#include <stdlib.h><br />void  

    [单选题]有以下程序#include #include void fun( double *p1,double *p2,d

  • 查看答案
  • ( 12 ) 有以下程序#include <stdio.h>#include <

    [试题]( 12 ) 有以下程序#include <stdio.h>#include <string.h>void fun ( char *str ){ char temp;int n,i;n=strlen ( str ) ;temp=str[n-1];for ( i=n-1;i>0;i-- ) str[i]=str[i-1];str[0]=temp;}main (){ char s[50];scanf ( " %s " ,s ) ; fun ( s ) ; printf

  • 查看答案
  • 有以下程序<br />#include <stdio.h><br />#include <stdlib.h><br />void fun(i

    [单选题]有以下程序#include #include void fun(int **s, int x[2][3]){ *

  • 查看答案
  • 有以下程序:<br />#include <stdio.h><br />#include <stdlib.h><br />int fun(i

    [单选题]有以下程序:#include #include int fun(int n){ int *p;p=(int*)m

  • 查看答案
  • ( 37 )有以下程序#include <stdio.h>#include <s

    [单选题]( 37 )有以下程序#include <stdio.h>#include <string.h>struct A{ int a; char b[10]; double c;};void f ( struct A t ) ;main (){ struct A a={1001, " ZhangDa " ,1098.0};f ( a ) ; printf ( " %d,%s,%6.1f/n " ,a.a,a.b,a.c ) ;}void f ( struct A t )

  • 查看答案
  • ( 37 )有以下程序#include <stdio.h>#include <s

    [单选题]( 37 )有以下程序#include <stdio.h>#include <string.h>struct A{ int a; char b[10]; double c;};void f ( struct A t ) ;main (){ struct A a={1001, " ZhangDa " ,1098.0};f ( a ) ; printf ( " %d,%s,%6.1f/n " ,a.a,a.b,a.c ) ;}void f ( struct A t )

  • 查看答案
  • ( 37 )有以下程序#include <stdio.h>#include <s

    [单选题]( 37 )有以下程序#include <stdio.h>#include <string.h>struct A{ int a; char b[10]; double c;};void f ( struct A t ) ;main (){ struct A a={1001, " ZhangDa " ,1098.0};f ( a ) ; printf ( " %d,%s,%6.1f/n " ,a.a,a.b,a.c ) ;}void f ( struct A t )

  • 查看答案
  • 有以下程序#include <stdio.h>#include <string.

    [单选题]有以下程序#include <stdio.h>#include <string.h>void fun(char s[][10],int n){ char t;int i,j;for(i=0;i<n-1;i++)for(j=i+1;j<n;j++)/* 比较字符串的首字符大小,并交换字符串的首字符 */if (s[i][0] > s[j][0]) {t=s[i][0];s[i][0]=s[j][0];s[j][0]=t;}}main(){ char ss[

  • 查看答案
  • 有以下程序#include <stdio.h>#include <stdlib.