Is the sizeof(some pointer) always equal to four?

前端 未结 17 1208
温柔的废话
温柔的废话 2020-11-22 11:49

For example: sizeof(char*) returns 4. As does int*, long long*, everything that I\'ve tried. Are there any exceptions to this?

17条回答
  •  失恋的感觉
    2020-11-22 12:41

    8 bit and 16 bit pointers are used in most low profile microcontrollers. That means every washing machine, micro, fridge, older TVs, and even cars.

    You could say these have nothing to do with real world programming. But here is one real world example: Arduino with 1-2-4k ram (depending on chip) with 2 byte pointers.

    It's recent, cheap, accessible for everyone and worths coding for.

提交回复
热议问题