How can I get the address of a struct in C?

后端 未结 1 430
野的像风
野的像风 2021-01-12 03:17

I\'m an absolute newbie to C so this may be a dumb question, warning!

It\'s inspired by the extra credit section of Exercise 16 in Learn C the Hard Way, if anyone i

1条回答
  •  清酒与你
    2021-01-12 04:05

    With the "address-of" operator unary &.

    struct Point offCenter = { 1, 1 };
    struct Point* offCentreAddress = &offCentre ;
    

    0 讨论(0)
提交回复
热议问题