convert array to two dimensional array by pointer

后端 未结 5 878
无人及你
无人及你 2020-12-17 02:22

Is it possible to convert a single dimensional array into a two dimensional array?

i first tought that will be very easy, just set the pointer of the 2D array to the

5条回答
  •  庸人自扰
    2020-12-17 02:31

    Yes, if you can use an array of pointers:

     int foo[] = {1,2,3,4,5,6};
     int *bla[2]={foo, foo+3};
    

提交回复
热议问题