main() { int a=1,b=3,c=5;int *p1=&a,*p2=&b,*p=&c;*p=*p1*(*p2);printf("%d\n",c)}这道题的解析

来源:学生作业帮助网 编辑:作业帮 时间:2024/11/08 18:09:30

main() { int a=1,b=3,c=5;int *p1=&a,*p2=&b,*p=&c;*p=*p1*(*p2);printf("%d\n",c)}这道题的解析
main() { int a=1,b=3,c=5;int *p1=&a,*p2=&b,*p=&c;*p=*p1*(*p2);printf("%d\n",c)}这道题的解析

main() { int a=1,b=3,c=5;int *p1=&a,*p2=&b,*p=&c;*p=*p1*(*p2);printf("%d\n",c)}这道题的解析
如下:最后一个输出语句还省一个结束的英文分号printf("%d\n",c)}
应该;printf("%d\n",c);}
main()
{
\x09int a=1,b=3,c=5;
\x09int *p1=&a,*p2=&b,*p=&c;//这一语句是定义三个指针变量,并赋值
\x09//即:使p1指向a;p2指向b;p指向c
\x09*p=*p1*(*p2);//该句是给p所指的存储单元c赋值,就是p1所指的存储单元的值,即a的值,与p2所指的存储单元b的值相乘
\x09//也就是c=a*b,等价于c=1*3=3;
\x09printf("%d\n",c);
}
运行结果:3

#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}, main() { int a,b,c; a=1;b=2;c=3; if(a #include int a=3,b=5; max (int a,int b) {int c; c=a>b?a:b; return (c); } void main() {int int fm(int a,int b) {if(b==1)return a; else return a+fm(a,b-1); } main( ) { printf(%d ,fm(4,3)) int fm(int a,int b) {if(b==1)return a; else return a+fm(a,b-1); } main( ) { printf(%d ,fm(4,3) #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 void fun(int a,int b) { int t; t=a;a=b;b=t; } main()void fun(int a,int b){ int t; t=a;a=b;b=t; } main() { int c[10]={1,2,3,4,5,6,7,8,9,0}.i; for(i=0;i #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 public class Test{ public static void main(String args[]){ int i=1,b,c; int[] a=new int[3]; b=a[i]; #include void main() { int a=1 b=2 c=3 cout .main() { int a=1,b=10; do {b-=a;a++;}while(b-- 矩阵相加(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 error C2065:'a' :undeclared identifier#includeint main(){int print_shang();int print_xia();print_shang();print_xia();return 0;}int print_shang(){int a,b;for(a=1;a main() { int x=1,y=2,z=3; int r; r=func(x+y+z,x++,++y); printf(%d,r); } int func(int a,int b,intint func(int a,int b,int c){int d;d=a+b+c;return d;} #includeint a(int x);int b(int y);int main(){int m,n;n=6;m=a(n);printf(%d ,m);return 0;}int a(int x){x=b(x+3);return x;}int b(int y){return y+1;} #include void fun(int a, int b) { int t; t=a; a=b; b=t;main() { int c[10]={1,2,3,4,5,6,7,8,9,0), i; for (i=0; i #include void fun(int a,int b) {int t; t=a;a=b;b=t; } main() {int c[6]={1,2,3,4,5,6},i;for(i=0;i int func(int x,int y ) { return(x+y) } main() {int a=1,b=2,c=3,d=4,e=5;printf(&d ,func((a+b,b+c,c+a),(d+e)));