cstdlib和stdlib.h有什么区别? [英] What's the difference between cstdlib and stdlib.h?

查看:629
本文介绍了cstdlib和stdlib.h有什么区别?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

编写C ++代码时有以下区别:

  #include< cstdlib> 

  #include< stdlib.h> 

除了前者主要包含在std :: namespace中吗?

$ b $

解决方案

除了编码标准和风格之外,还有其他任何原因吗?第一个是C ++头文件,第二个是C头文件。因为第一个使用命名空间,这似乎是更可取的。


When writing C++ code is there any difference between:

#include <cstdlib>

and

#include <stdlib.h>

other than the former being mostly contained within the std:: namespace?

Is there any reason other than coding standards and style to use one over the other?

解决方案

The first one is a C++ header and the second is a C header. Since the first uses a namespace, that would seem to be preferable.

这篇关于cstdlib和stdlib.h有什么区别?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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