C++中“->”和“.”在使用中有什么区别呢
2016-04-01 10:53
501 查看
1、->是指针指向其成员的运算符 .是结构体的成员运算符。最大的区别是->前面放的是指针,而.前面跟的是结构体变量。
2、例如:
2、例如:
struct A { int a; int b; }; A *point = malloc(sizeof(struct A)); point->a = 1; A object; object.a = 1;
相关文章推荐
- 详解一道C++笔试题,考察重载、覆盖、多态
- C++ 函数传递指针的引用或指针的指针,指针的值被改变
- 定义为指针,声明为数组
- 【设计模式C++】工厂模式
- 【C++】《C++标准程序库》小结第十三章-stream(3)
- c++第2次作业
- C++面试题
- C++: How is the process of function calling in C++
- C++: How is the process of function calling in C++
- C++: How is the process of function calling in C++
- C++: How is the process of function calling in C++
- C++: How is the process of function calling in C++
- C++: How is the process of function calling in C++
- C++: How is the process of function calling in C++
- C++ STL中vector、list、deque和map的区别
- C++编译错误syntax error : identifier 'THIS_FILE' 解决方法
- VC++2005下的ADO SQL语句(like,count,distinct)和操作(转)
- [C++]各种排序方法
- 关于 C/C++ 的文章
- C语言宏的定义及使用