c语言作业(*p &n)用法1.Study the following section of C code:int n1 = 2,n2 = 5,n3[ ] = {3,4,5,6,7};int* p1 = &n1;int * p2 = n3;*p2 = (*p1)++ + *(p2) ; p2 = &n3[3];n1 = *p1 + *(p2) + *(&n2); p1 = &n3[4];What are the values of *p1,*p2,n1,n2 an
来源:学生作业帮助网 编辑:作业帮 时间:2024/07/05 15:34:18
![c语言作业(*p &n)用法1.Study the following section of C code:int n1 = 2,n2 = 5,n3[ ] = {3,4,5,6,7};int* p1 = &n1;int * p2 = n3;*p2 = (*p1)++ + *(p2) ; p2 = &n3[3];n1 = *p1 + *(p2) + *(&n2); p1 = &n3[4];What are the values of *p1,*p2,n1,n2 an](/uploads/image/z/9486689-41-9.jpg?t=c%E8%AF%AD%E8%A8%80%E4%BD%9C%E4%B8%9A%EF%BC%88%2Ap+%26n%EF%BC%89%E7%94%A8%E6%B3%951.Study+the+following+section+of+C+code%3Aint+n1+%3D+2%2Cn2+%3D+5%2Cn3%5B+%5D+%3D+%7B3%2C4%2C5%2C6%2C7%7D%3Bint%2A+p1+%3D+%26n1%3Bint+%2A+p2+%3D+n3%3B%2Ap2+%3D+%28%2Ap1%29%2B%2B+%2B+%2A%28p2%29+%3B+p2+%3D+%26n3%5B3%5D%3Bn1+%3D+%2Ap1+%2B+%2A%28p2%29+%2B+%2A%28%26n2%29%3B+p1+%3D+%26n3%5B4%5D%3BWhat+are+the+values+of+%2Ap1%2C%2Ap2%2Cn1%2Cn2+an)
c语言作业(*p &n)用法1.Study the following section of C code:int n1 = 2,n2 = 5,n3[ ] = {3,4,5,6,7};int* p1 = &n1;int * p2 = n3;*p2 = (*p1)++ + *(p2) ; p2 = &n3[3];n1 = *p1 + *(p2) + *(&n2); p1 = &n3[4];What are the values of *p1,*p2,n1,n2 an
c语言作业(*p &n)用法
1.Study the following section of C code:int n1 = 2,n2 = 5,n3[ ] = {3,4,5,6,7};int* p1 = &n1;int * p2 = n3;*p2 = (*p1)++ + *(p2) ; p2 = &n3[3];n1 = *p1 + *(p2) + *(&n2); p1 = &n3[4];What are the values of *p1,*p2,n1,n2 and n3 after the last statement?(25 points)*p1=7,*p2=6,n1=14,n2=5,n3[]=[5,4,5,6,7]
c语言作业(*p &n)用法1.Study the following section of C code:int n1 = 2,n2 = 5,n3[ ] = {3,4,5,6,7};int* p1 = &n1;int * p2 = n3;*p2 = (*p1)++ + *(p2) ; p2 = &n3[3];n1 = *p1 + *(p2) + *(&n2); p1 = &n3[4];What are the values of *p1,*p2,n1,n2 an
int n1 = 2,n2 = 5,n3[ ] = {3,4,5,6,7};
int *p1 = &n1; // 这使 *p1=2
int *p2 = n3; // 这使p2指向 n3[0],*p2=3
*p2 = (*p1)++ + *(p2) ;
// 注意后坠加,表达式里用原来的值,出表达式后自增1
// 所以 *p2=2+3=5; 出表达式后 *p1=2+1=3;
// 由于 p2指向 n3[0],所以 n3[0]=5; 新值5!
p2 = &n3[3]; // p2指向 n3[3],它的值 *p2=6
n1 = *p1 + *(p2) + *(&n2); // *(&n2) 就是n2=5,n1=3+6+5 =14
p1 = &n3[4]; // *p1=7
printf("%d %d %d %d\n",*p1,*p2,n1,n2);
当前 值:7 6 14 5
n3[]=[新值5,老值 4,5,6,7];