#include int b=3; int fun(int *a) { b+=*a; return(b); }void main(){ int a=2,b=2;b+=fun(&a);printf(“%d\n”,b);读程序写出程序执行结果

来源:学生作业帮助网 编辑:六六作业网 时间:2024/11/23 08:45:31
#includeintb=3;intfun(int*a){b+=*a;return(b);}voidmain(){inta=2,b=2;b+=fun(&a);printf(“%d\n”,b);读程序写

#include int b=3; int fun(int *a) { b+=*a; return(b); }void main(){ int a=2,b=2;b+=fun(&a);printf(“%d\n”,b);读程序写出程序执行结果
#include int b=3; int fun(int *a) { b+=*a; return(b); }
void main()
{ int a=2,b=2;
b+=fun(&a);
printf(“%d\n”,b);
读程序写出程序执行结果

#include int b=3; int fun(int *a) { b+=*a; return(b); }void main(){ int a=2,b=2;b+=fun(&a);printf(“%d\n”,b);读程序写出程序执行结果
输出结果是7.
原因:
fun(int *a)函数中使用到的是b变量是全局变量,值为3,main()函数中b+=fun(&a)中b是局部变量,值为2,因而调用函数fun(&a)结果为5,因而输出结果是7.

#include   int inc(int a)   {    return(++a);   }   int multi(int*a,int*b,int*c)   {    return(*c=*a**b);   }   typedef int(FUNC1)(int in);   typedef int(FUNC2) (int*,int*,int*);   void show(FUNC2 fu #include int a=3,b=5; max (int a,int b) {int c; c=a>b?a:b; return (c); } void main() {int #include int inc(int a) { return(++a); } int multi(int*a,int*b,int*c) { return(*c=*a**b); }typedef int(FUNC1)(int in);  typedef int(FUNC2) (int*,int*,int*);  void show(FUNC2 fun,int arg1,int*arg2)  {  INCp=&inc;  int temp =p(arg1) #include int inc(int a){ return(++a); }int multi(int*a,int*b,int*c){ return(*c=*a**b); }typedef int(FUNC1)(int in);typedef int(FUNC2) (int*,int*,int*);void show(FUNC2 fun,int arg1,int*arg2){FUNC1 p=&inc;int temp =p(arg1);fun(&temp,&arg1,arg2);printf( #include using namespace std; int main() { int a,b,c; a=3; int f(int x,int y,int z);#include using namespace std; int main() {int a,b,c;a=3;int f(int x,int y,int z); cin>>a>>b>>c;c=f(a,b,c);cout #include int b=2; int fun(int *k) {b=*k+b;return(b);} main() {int a[10]={1,2,3,4,5,6,7,8}, #include int b=2; int fun(int*k) { b=*k+b;return(b);} main() {int a[10]={1,2,3,4,5,6,7,8}#include int b=2; int fun(int*k) { b=*k+b;return(b);} main() {int a[10]={1,2,3,4,5,6,7,8},i;for(i=2;i #include #include main() { float a; int b; a=4.55 ; b=4.5%3; printf(%f %d,a,#include#includemain(){float a;int b;a=4.55 ;b=4.5%3;printf(%f %d,a,b);getch();} 实在看不懂#include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include using namespace std;int cases;int main() {double cl = clock();scanf(%d, 画椭圆代码出错# include # include # include # include void MidpointEllipse(int a,int b,int color); int main() { int gdriver = DETECT,gmode=0; initgraph(500,600); MidpointEllipse(4,6,RED); getch(); closegraph(); return 0; } void MidpointE #include void main() { int a=1 b=2 c=3 cout #include void main(){ int b=3;int a; int arr[]={6,7,8,9,10}; int *ptr=arr; *(ptr++)+=123;#include using namespace std;void main(){ int b=3;int a; int arr[]={6,7,8,9,10}; int *ptr=arr; *(ptr++)+=123; printf(%d,%d ,*(p #include int fun(int b[].int n) { int i.r=1:for(i=0:i #include int f1(int a,int b)15,9 { int c; c=b%2; return a+c; }int f2(int a,int b){ int c;a+=a;b+=b;c=f1(a+b=14,++b9);return c;}void main(){ int a=3,b=4;cout 矩阵相加(C++)#include using namespace std; const int rows=3;const int cols=3;void matrixadd(int *,int *,int *,int,int);int main(){int a[rows][cols]={{1,3,5},{7,8,11},{13,15,17}};int b[rows][cols]={{9,8,7},{6,5,4},{3,2,1}};int c[rows][cols]={0 什么叫'int ' differs in levels of indirection from 'void *'我的程序代码如下(部分)(运行界面visual C++):#include #include #include main(){ int number=-1;int i=0;int a=0;char b[50];char code[1000];char cache[50];char *m=&b[50] ..有两个错误在下面#include #include int sum( int b[ ],int n ){ int i,s = 0;for ( i=0; i #include int b=3; int fun(int *a) { b+=*a; return(b); }void main(){ int a=2,b=2;b+=fun(&a);printf(“%d ”,b);读程序写出程序执行结果