When to use short instead of int?

前端 未结 5 1667
梦如初夏
梦如初夏 2021-02-08 11:46

Two use cases for which I would consider short come to mind:

  1. I want an integer type that\'s at least 16 bits in size
  2. I want an integer type t
5条回答
  •  旧巷少年郎
    2021-02-08 12:09

    If you have a very large array you might want to use shorts.

    You might find them useful for picking out pieces of some other data as part of a union.

提交回复
热议问题