![](https://img-blog.csdnimg.cn/20201014180756922.png?x-oss-process=image/resize,m_fixed,h_64,w_64)
C++学习-----------基础
gwbin198808
这个作者很懒,什么都没留下…
展开
-
struct和typedef struct的比较
分三块来讲述: 1 首先://注意在C和C++里不同 在C中定义一个结构体类型要用typedef: typedefstruct Student { int a; }Stu; 于是在声明变量的时候就可:Stu stu1;(如果没有typedef就必须用structStudent stu1;来声明) 这里的Stu实际上就是struct Student的别名转载 2013-03-21 12:09:25 · 460 阅读 · 0 评论 -
auto_ptr用法
1. auto_ptr的意义 auto_ptr是一种智能指针,当系统异常退出的时候避免资源泄漏(内存)。 其他的资源还对应其他的智能指针。 2 auto_ptr的使用 std::auto_ptr test(new int(1)); test将是一个auto_ptr的对象,使用一个int指针进行初始化。 test可以象其他指针一样使用,如使用* 使用->但是++不可以使用,以后也许转载 2013-04-11 20:46:50 · 538 阅读 · 0 评论