calloc(4, 6) 和 calloc(6, 4) 一样吗? [英] Is calloc(4, 6) the same as calloc(6, 4)?

查看:28
本文介绍了calloc(4, 6) 和 calloc(6, 4) 一样吗?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我是一名初学 C 程序员,我认为情况确实如此,但如果可能,我希望得到一些肯定.

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 argument instead?

推荐答案

都是一样的.原因是因为大多数时候您希望使用 sizeof 运算符作为参数之一.如果传递两个参数让您感到困扰,请调用具有单个参数的 malloc().

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.

这篇关于calloc(4, 6) 和 calloc(6, 4) 一样吗?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆