int a[10]={1,2,3,4,5,6,7,8,9,10},*p=&a[3],b; b=p[5];b=9 想知道详解

来源:学生作业帮助网 编辑:六六作业网 时间:2024/12/23 02:49:26
inta[10]={1,2,3,4,5,6,7,8,9,10},*p=&a[3],b;b=p[5];b=9想知道详解inta[10]={1,2,3,4,5,6,7,8,9,10},*p=&a[3],b

int a[10]={1,2,3,4,5,6,7,8,9,10},*p=&a[3],b; b=p[5];b=9 想知道详解
int a[10]={1,2,3,4,5,6,7,8,9,10},*p=&a[3],b; b=p[5];
b=9 想知道详解

int a[10]={1,2,3,4,5,6,7,8,9,10},*p=&a[3],b; b=p[5];b=9 想知道详解
a可以理解为这个数组的首地址
a[3]是指向第4个元素
所以p指向第4个元素
p[5]是从p后的5个 也就是第9个元素
所以b=9

#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}, 矩阵相加(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 #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 int a[3][3]={{1,2,3},{4,5,6},{7,8,9}}; int **p; p=(int**)a; 其中p=(int**)a;是什么意思啊 一个关于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;} #define N 20 fun(int a[],int n,int m) {int i; for(i=m;i>n;i--)a[i+1]=a[i]; return m; } void main() #define N 20fun(int a[],int n,int m){int i;for(i=m;i>n;i--)a[i+1]=a[i];return m;}void main(){ int i,a[N]={1,2,3,4,5,6,7,8,9,10};fun(a,0,N/2);for(i=0;i #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 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 #include stdio.h 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#include stdio.hvoid 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 int a[3][3]={{1,2,3},{4,5},{6}}; int i, Int[] a={1,2,3,4,5}; For(int count=0;count int b=2;int fun(int*k) {b=*k=b;return (b);} main() {int a[10]={1,2,3,4,5,6,7,8} for (i=2;i 下列数组定义错误的是 A.int x=5,a[x]; B.int aa[1]; C.int aa[2][3]; D.int a['a']; 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]=______ #define N 20 fun(int a[],int n,int m) { int i; for(i=m;i>=n;i--) a[i+1]=a[i]; return a[a+1]; } main#define N 20fun(int a[],int n,int m){ int i;for(i=m;i>=n;i--)a[i+1]=a[i];return a[a+1];}main(){int i,a[N]={1,2,3,4,5,6,7,8,9,10};fun(a,2,9);for(i=0;i int a[]={5,10,15,20,25,30}; int b=LA(a,4); int c=LA(a+2,3);printf(%d %d ,b,#include stdio.hint LA(int *a,int n){int i,s=0;for(i=0;i 应用函数、数组、指针求数组中的最大值、最小值、平均值. 我作出了一个但是总是出错?#includeint max(int *p);int min(int *q);double averrage(int *n);void main(){ int a[10]={1,2,3,4,5,6,7,8,9,10}; int k,z; double s;