int x[5]={1,2,3,4,5,},y[5];错在哪?

来源:学生作业帮助网 编辑:作业帮 时间:2024/11/27 19:39:39
x)+Q661111թթX2O'I*'R~ L7}:EOz0ivgSv>ٱ F><;ST
一个关于C语言指针的问题,源程序:#include intmain(){int a[5]={1,2,3,4,5};int *ptr1=(int *)(&a+1);int *ptr2=(int *)((int)a+1);printf(%x,%x,ptr1[-1],*ptr2);return 0;} 下列数组定义错误的是 A.int x=5,a[x]; B.int aa[1]; C.int aa[2][3]; D.int a['a']; 矩阵相加(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 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))); int[][]myarray=new int[][]{new int[]{1,2.3},}new int[]{4,5,6,7},new int{8,9,10,11,12},new int[]{-1.int[][]myarray=new int[][]{new int[]{1,2.3},}new int[]{4,5,6,7},new int[]{8,9,10,11,12},new int[]{-1.0}}; myarray[2][1]=______ int a[3][3]={{1,2,3},{4,5,6},{7,8,9}}; int **p; p=(int**)a; 其中p=(int**)a;是什么意思啊 #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}, 有如下类定义 class Sample{ public:Sample(int x):ref(x){} //1 private:Sample():ref(0){} //2staric int val=5;//3const int ref;};//4请问 上述程序,错误的语句是————? int a[3][3]={{1,2,3},{4,5},{6}}; int i, Int[] a={1,2,3,4,5}; For(int count=0;count #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 void InSertSort(int R[],int n);特别这一行void main(){int arr[]={0,1,2,3,4,5,6,7,8,9};int n=9;InSertSort(arr,10);}void InSertSort(int R[],int n)特别这一行{int i,j;int temp;for(i=1;i=0&&temp int a[]={1,2,3,4,2,4,5,2}; int b=LB(a,4)+LB(a+3,#includeint LB(int *a,int n) {int i,s=1;for(i=0;i int x[5]={1,2,3,4,5,},y[5];错在哪? #include int fun(int*x,int n) { if (n==0) return x[0]; else return x[0]+fun(x+1,n-1); }void main(){int a[]={1,2,3,4,5,6,7};printf(%d ,fun(a,2) );} #include void main(){int k1=1;int k2=2;int k3=3;int x=15;if(!k1) x--;else if(k2) x=4;else x=3;printf(%d,x);} #includevoid put(int ar[][5],int n);int main(void){int zhou[3][5]={{1,2,3,4,5},{2,3,4,5,6},{3,4,5,6,7}};put(zhou,5);return 0;}void put(int ar[][5],int n){int r,c;for(r=0;r 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