网友您好, 请在下方输入框内输入要搜索的题目:

题目内容 (请给出正确答案)

有如下程序段,则下面与n=3;等价的语句是: int n; int *p1; p1=&n;

A.3=n;

B.p1=3;

C.*p1=3;

D.&p1=3;


参考答案和解析
*p1=3;
更多 “有如下程序段,则下面与n=3;等价的语句是: int n; int *p1; p1=n;A.3=n;B.p1=3;C.*p1=3;D.p1=3;” 相关考题
考题 有以下程序main(){ int a=1,b=3,c=5;int *p1=a, *p2=b, *p=c;*p =*p1*(*p2);printf("%d\n",c);}执行后的输出结果是A)1B)2C)3D)4

考题 若有以下函数首部int fun(double x[10], int *n)则下面针对此函数的函数声明语句中正确的是A)int fun(double x, int *n);B)int fun(double , int );C)int fun(double *x, int n);D)int fun(double *, int *);

考题 阅读下面程序段,则执行后的结果为#include "stdio.h"main(){int m=4,n=2,k;k=fun(m,n);printf("%d\n",k);}fun(int m,int n){return(m*m*m-n*n*n);}A.64B.8C.56D.0

考题 阅读下面程序: include void fun(int n) { int x(5); static int y(10); if(n>0) { 阅读下面程序:include<iostream.h>void fun(int n){int x(5);static int y(10);if(n>0){++x;++y;cout<<x<<","<<y<<end1;}}void main(){int m(1);fun(m);}则该程序的输出结果是______。

考题 有以下面程序: include using namespace std; long fib(int n) { if (n>2)return (fi 有以下面程序:include <iostream>using namespace std;long fib(int n){if (n>2)return (fib(n-1)+fib(n-2));elsereturn 2;}int main(){cout<<fib(3)<<endl;return 0;}则该程序的输出结果应该是【 】。

考题 写出下列程序的执行结果。 swap(p1,p2) int*p1,*p2; {int p; p=*p1;*p1=*p2;*p2=p; } main() {int a,b,*p1,*p2; scanf("%d%d",a,B); p1=a;p2=b; if(a<B)swap(p1,p2); printf("\na=%d,b=%d\n",a,B); } 若a=7,b=8,则程序的运行结果为( )。

考题 阅读下面程序: include void f(int n) { int x(5); static int y(10); if(n>0) { ++ 阅读下面程序:include<iostream.h>void f(int n){int x(5);static int y(10);if(n>0){++x;++y;cout<<x<<","<<y<<endl;}}void main(){int m(1);f(m),}则该程序的输出结果是【 】

考题 有如下程序: include using namespace std; int strle(char a[],char b[]) {int num= 有如下程序:include <iostream>using namespace std;int strle(char a[],char b[]){int num=O,n=O;while (* (a+num) !='\0')num++;while (b [n] ){* (a+num)=b [n];num++;n++;}return(num);}int main (){char strl[80],str2[80],*p1=str1,*p2=str2;cin>>p1;cin>>p2;cout<<strle(p1,p2)<<end1;return 0;}运行上述程序,如果从键盘输入字符串qwerty和字符串abcd,则程序的输出结果是【 】。

考题 有如下程序:includeusing namespace std;long fun(int n){if(n>2)return(fun(n-1)+fu 有如下程序: #include<iostream> using namespace std; long fun(int n) { if(n>2) return(fun(n-1)+fun (n-2)); else return 2; } int main() { cout<<fun(3)<<end1; return 0; } 则该程序的输出结果应该是 ( )。A.2B.3C.4D.5

考题 若有说明:int*p1,*p2,n=8,m;下列均是正确赋值语句的选项是( )。A.p1=n;p2=p1;B.p1=n;C.p1=n;*p2=p1;D.p1=n;p2=p1;

考题 若有说明:int*p1,*p2,n=8,m;下列均是正确赋值语句的选项是( )。A.p1:n;p2=pl;B.p1=n;C.p1=n;*p2=p1;D.p1=n;p2=p1;

考题 阅读下面程序: include using namespace std; long fib(int n) {if(n > 2) return(fib 阅读下面程序:include<iostream>using namespace std;long fib(int n){if ( n > 2 )return (fib(n-1)+fib(n-2));elsereturn 2;}int main(){cout<<fib(3)<<end1;return 0;{则该程序的输出结果应该是【 】。

考题 下面程序的运行结果为 include Class Astatic int n; public: A( ) {n=1;} A(int n 下面程序的运行结果为#include<iostream.h>Class Astatic int n;public:A( ) {n=1;}A(int num) {n=num;}void print( ) {cout < < n;}};int A: :n=2;void main( ){A a,b(3) ;a. print( ) ;b. print( ) ;cout < < endl;}A.11B.13C.23D.33

考题 有如下程序:includeusing namespace std;class Base{int x;public:Base(int n=0):x(n 有如下程序: #include<iostream> using namespace std; class Base{ int x; public: Base(int n=0):x(n){cout<<n;} int getX( )const{return x;} }; class Derived:public Base{ int y; public: Derived(int m,int n):y(m),Base(n){tout<<m;} Derived(int m):y(m){cout<<m;} }; int main( ){ Derived dl(3),d2(5,7); return 0; } 程序的输出结果是A.375B.357C.0375D.0357

考题 下列程序的输出结果是______。 main() {int a=2,b=4,c=6; int*p1=a,*p2=b,*p; *(p=int*p1=a,*p2=b,*p;*(p=C) =*p1*(*p2);printf("%d\n",c);}

考题 若有说明:int*p1,*p2,m=3,n;则p1=p2=p1;是正确的赋值语。() 此题为判断题(对,错)。

考题 若有以下函数首部: int fun(double x[10],int *n) 则下面针对此函数的函数声明语句中正确的是( )。A.int fun(double x, int *n);B.int fun(double, int);C.int fun(double *x, int n);D.int fun(double*, int*);

考题 下列程序的输出结果是______。main(){ static int num[5]=}1,3,5,7,9};int*p1,**p2;p1=num;p2=p1; printf("%d,",*(++p1)); printf("%d\n",**p2); }A.3,1B.3,3C.1,1D.1,3

考题 有以下程序includevoid fun(float* p1,int n1,float,*p2,int n2,float* s){ int i;s=( 有以下程序 #include<stdio.h> void fun(float * p1,int n1,float,*p2,int n2,float * s) { int i; s=(float *)calloc(1,sizeof(float)); *s=0; for(i=0;i<n1;i++) *s+=*p1++; for(i=0;i<n2;i++) *s+=*p2++; } main() { float a[2]={1.1,2.2},b[3]={10.0,20.0,30.0),*s=a; fun(a,2,b,3,s); printf("%f\n",*s); } 上面程序的输出结果是( )A.60B.3.3C.63.3D.1.1

考题 有以下程序: main() {int a=1,b=3,c=5; int*p1=&a,*p2=&b,*p=&c; *p=*p1*(*p2); printf("%d\n",C); } 执行后的输出结果是( )。A.1B.2C.3D.4

考题 若有如下程序: int sub() {static int n=1; int x=1; x*=n;n++; return x; } main() {int n,t=1; for(n=1;n<6;n++)t*=sub(); printf("%d\n",t); } 则程序运行后的输出结果是( )A.15B.120C.34560D.-30976

考题 若有如下程序: sub(int * t,int n) {int *p1, *p2; for(p1=t,p2=t;p1-t<n;p1++) if(*p1<*p2) p2=p1; return(*p2);} main() {int a[9]={9,36,19,39,26,5,6,33,15}; printf("%d\n",sub(a,9));} 则程序运行后的输出结果是( )A.5B.9C.15D.39

考题 已知:int n=1;在下面定义引用的语句中,正确的是( )。A.int x=n;B.int x =n;C.int x;D.int x=n;

考题 用指针作函数参数,编程序求一维数组中的最大和最小的元素值。#define N 10main(){ void maxmin(int arr[],int *pt1,int *pt2,int n);int array[N]={10,7,19,29,4,0,7,35,-16,21},*p1,*p2,a,b;p1=a; p2=b;maxmin(array,p1,p2,N);printf("max=%d,min=%d",a,b);}void maxmin(int arr[],int *pt1,int *pt2,int n){ int i;*pt1=*pt2=arr[0];for(i=1;iN;I++){ if(arr[i]*pt1) (9) ;if(arr[i]*pt2) (10) ;}}

考题 若有说明:int *p1,*p2,m=5,n; 以下都是正确的赋值语句的选项是()。A、p1=m; p2=p1;B、p1=m; p2=n; *p1=*p2;C、p1=m; p2=p1;D、p1=m; *p2=*p1;

考题 有定义:int a[10], n, *p1=a,*p2=a[9];,则正确的赋值语句为()。A、n=p2-p1;B、n=p2*p1;C、n=p2+p1;D、n=p1/p2;

考题 若有说明:int*p1,*p2,m=5,n=9;以下均是正确赋值语句的选项是()A、p1=m;p2=p1;B、p1=m;p2=n;*p1=*p2;C、p1=m;p2=p1D、p1=m;*p2=*p1;

考题 单选题有定义:int a[10], n, *p1=a,*p2=a[9];,则正确的赋值语句为()。A n=p2-p1;B n=p2*p1;C n=p2+p1;D n=p1/p2;