有关C ++,C,MFC的几个问题 [英] A couple questions regarding C++, C, MFC

查看:90
本文介绍了有关C ++,C,MFC的几个问题的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

请向我解释以下内容:
1.空指针和空指针之间的区别.
2.为什么需要Null指针?
3. malloc()和calloc()之间的区别.
4."extern"关键字的用途

Please explain these to me:
1. Difference between void pointer and Null pointer.
2. Why Null pointer is necessary?
3. Difference between malloc() and calloc().
4. Purpose of "extern" keyword

Thanks in advance!

推荐答案

(1) void 是一种类型, NULL 是一个值.
(2)为什么在集合论中必须要有空集合?
(3)calloc初始化(使用零)分配的内存,而malloc不初始化.
(4)使用extern:
-声明在另一个源文件中定义的变量(例如extern int g_instance_count;).
-通知C++编译器某些代码为C(例如extern "C" {/* C functions here */ }).
(1) void is a type, NULL is a value.
(2) Why the empty set is necessary in set theory?
(3) calloc initializes (with zeroes) allocated memory while malloc doesn''t.
(4) extern is used:
- to declare a variable defined in another source file (e.g. extern int g_instance_count; ).
- to notify the C++ compiler that some code is C (e.g. extern "C" {/* C functions here */ }).


1.空指针和空指针之间的区别.
  void*是一种指针,但是NULL是任何指针都可以假定的值.

2.为什么需要Null指针?
  NULL通常用于指示指针没有指向任何东西.
1. Difference between void pointer and Null pointer.
 void* is a type of pointer but NULL is a value that any pointer can assume.

2. Why Null pointer is necessary?
 NULL is normally used to indicate that the pointer doesn''t point to anything.


外部关键字用于提供链接.
extern key word is used to provide linkage.


这篇关于有关C ++,C,MFC的几个问题的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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