Is calloc(4, 6) the same as calloc(6, 4)?

前端 未结 7 1633
南旧
南旧 2020-12-08 06:49

I\'m a beginner C programmer, and I assumed that this would be the case, but would like some affirmation if possible.

If they are the same, why not just take one arg

7条回答
  •  攒了一身酷
    2020-12-08 07:33

    It is the same. The reason is because most of the time you want to use a sizeof operator as one of the arguments. If passing two parameters bother you, call malloc() which has a single argument.

提交回复
热议问题