Why do we have pointers other than void

前端 未结 10 997
攒了一身酷
攒了一身酷 2020-12-30 22:54

I know that we have different pointers like int, float, and char. A void pointer is the only pointer which can hold all o

10条回答
  •  心在旅途
    2020-12-30 23:00

    Type safety. Defining the type of pointers helps the compiler find errors where you are trying to use data of the wrong type through a pointer. That's the reason C has types in the first place.

提交回复
热议问题