c pointers and array

前端 未结 4 1651
后悔当初
后悔当初 2021-01-18 02:20
#include 
#include 

int main (void)
{
    int a[] = {1,2,3,4,5};
    int b[] = {0,0,0,0,0};
    int *p = b;

    for (int i =0; i <         


        
4条回答
  •  太阳男子
    2021-01-18 03:26

    after the first for{},p point at b[5],but the size of b is 5,so b[5] value is unknow,the printf *p is the same value as a[i],the reason may be in memory b[5] is a[0].

提交回复
热议问题