Shouldn't an int pointer in Turbo C be of size 4 bytes?

前端 未结 5 865
长发绾君心
长发绾君心 2020-12-04 03:47

In the Turbo C compiler, the size of an int pointer is shown as 2 bytes when sizeof() operator is used. Now, if I print the address of an int variable, it comes out to be a

5条回答
  •  轻奢々
    轻奢々 (楼主)
    2020-12-04 04:20

    You probably have a 16-bit version of Turbo C, and that's the size of int for that compiler: http://www.cs.technion.ac.il/~nikol/material/types_sizes.pdf

    In fact, all versions of Turbo C were 16-bit, apparently.

    As the others already suggested, get yourself a modern C compiler, like gcc or clang.

提交回复
热议问题