int a=3,b=4,*q=&b; *q=a+b;a=5; q=(a
来源:学生作业帮助网 编辑:六六作业网 时间:2024/12/20 08:25:58
inta=3,b=4,*q=&b;*q=a+b;a=5;q=(ainta=3,b=4,*q=&b;*q=a+b;a=5;q=(ainta=3,b=4,*q=&b;*q=a+b;a=5;q=(ainta
int a=3,b=4,*q=&b; *q=a+b;a=5; q=(a
int a=3,b=4,*q=&b; *q=a+b;a=5; q=(a
int a=3,b=4,*q=&b; *q=a+b;a=5; q=(a
int a=3,b=4,*q=&b; //定义a,b两个整形变量并赋值.定义整形指针变量q,并将变量b的地址赋给q.& 就是取地址.
*q=a+b;//*q表示指针变量q指向的地址,将a+b的值赋给这个地址.就是b代表的地址.b=a+b=3+4=7
a=5;//给a赋值.a=5
q=(a<b)?&a:&b;//表达式1?表达式2:表达式3.如果表达式1是真值,就是非零,取表达式2的值,作为整体的值;如果是假,就是零,取表达式3,作为整体的值.
//&a和&b就是取a,b的地址.q=(a<b)?&a:&b=(5<7)?&a:&b=(TRUE)?&a:&b=&a.q指向a
printf("%d %d %d\n",a,b,*q);//a=5,b=7,*q=a=5
int a=3,b=4,*q=&b; *q=a+b;a=5; q=(a
#include void main( ) { int a=3,b=5; int *p,*q; void f1(int x,int y);void f2(int *x,int *y);p=&a; q=&b;f1(*p,*q) ;printf(a=%d ,b=%d
,a,b);f2(p,q);printf(a=%d ,b=%d
,a,b);}void f1(int x,int y) { int t;t=x; x=y; y=t;}void f2(int *x,int *y) { int
void fun(int *a,int *b) { int *c; c=a;a=b;b=c; } main() { int x=3,y=5,*p=&x,*q=&y; fun(p,q);...void fun(int *a,int *b){ int *c; c=a;a=b;b=c;}main(){ int x=3,y=5,*p=&x,*q=&y; fun(p,q); printf(%d,%d,,*p,*q); fun(&x,&y); prin%d,%d
,*p,*q);}两
定义int b[3][4],*q[3]; 下列赋值表达式中是正确的A.q=b b.q=*b c.*q=b+1 D.*q=&b[1][2] 为什么呢?A q=bB q=*bC *q=b+1D *q=&b[1][2]
swap交换函数,用指针实现.#include stdafx.hvoid swap(int &a,int &b ){int* p=&a;int* q=&b; int* t ;if(*p>*q){ t=p;p=q;q=t;}//a=*p;//b=*q;}int main(){int a=12;int b= 1;printf(a=%d
b = %d
,a,b);swap(a,b);printf(a=%d
b = %d
,a,b);re
#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
#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 b=2; int fun(int *k) {b=*k+b;return(b);} main() {int a[10]={1,2,3,4,5,6,7,8},
void fun(int *a,int *b) { int *c; c=a;a=b;b=c; } main() { int x=3,y=5,*p=&x,*q=&y; fun(p,q);...void fun(int *a,int *b){int *c;c=a;a=b;b=c;}main(){int x=3,y=5,*p=&x,*q=&y;fun(p,q); printf(%d,%d,,*p,*q);fun(&x,&y); prin%d,%d
,*p,*q);}两次调用
#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 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
int a,b; b = a >>
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 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 void f(int *p,int*q); main() {int m=1,n=2,*r=&m; f(r,&n);printf(%d,%d,m,n);}#include void f(int *p,int*q);main(){int m=1,n=2,*r=&m;f(r,&n);printf(%d,%d,m,n);}void f(int *p,int *q){p=p+1;*q=*q+1;}运行后的结果是A 1,3 B 1,2 说说为
int*a[3] for(int i=0;i>ba[i]=new int[b] }
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