c pointer to array of structs

后端 未结 4 2436
刺人心
刺人心 2020-12-05 05:13

I know this question has been asked a lot, but I\'m still unclear how to access the structs.

I want to make a global pointer to an array of structs:

         


        
4条回答
  •  陌清茗
    陌清茗 (楼主)
    2020-12-05 06:13

    I would use a pointer to a pointer like:

    test_t array_t1[1024];
    test_t **ptr;
    ptr = array_t1;
    ptr[0] = ...;
    ptr[1] = ...;
    etc.
    

提交回复
热议问题