C pass int array pointer as parameter into a function

前端 未结 9 1417
借酒劲吻你
借酒劲吻你 2020-12-08 04:39

I want to pass the B int array pointer into func function and be able to change it from there and then view the changes in main function

#include 

        
9条回答
  •  醉梦人生
    2020-12-08 05:25

    main()
    {
        int *arr[5];
        int i=31, j=5, k=19, l=71, m;
    
        arr[0]=&i;
        arr[1]=&j;
        arr[2]=&k;
        arr[3]=&l;
        arr[4]=&m;
    
        for(m=0; m<=4; m++)
        {
            printf("%d",*(arr[m]));
        }
        return 0;
    }
    

提交回复
热议问题