
C++
SilenceHell
学生,希望能在csdn上学到知识。
展开
专栏收录文章
- 默认排序
- 最新发布
- 最早发布
- 最多阅读
- 最少阅读
-
malloc和new的区别
0. 属性new/delete是C++关键字,需要编译器支持。malloc/free是库函数,需要头文件支持。1. 参数使用new操作符申请内存分配时无须指定内存块的大小,编译器会根据类型信息自行计算。而malloc则需要显式地指出所需内存的尺寸。2. 返回类型new操作符内存分配成功时,返回的是对象类型的指针,类型严格与对象匹配,无须进行类型转换,故new...转载 2018-07-07 15:40:39 · 195 阅读 · 0 评论 -
string、const char*、 char* 、char[]相互转换
转载于:https://blog.csdn.net/rongrongyaofeiqi/article/details/52442169 谢谢原博主的总结。 string、const char*、 char* 、char[]四者类型经常会需要转化。 一:...转载 2018-09-13 15:26:18 · 181 阅读 · 0 评论 -
C++产生指定范围的随机数
转载于:https://blog.csdn.net/garfielder007/article/details/51386490 C/C++编程产生指定范围内的随机数,直接上个小程序: #include <stdlib.h> // 对应于C++中cstdlib#include <time.h> // ctime#include <stdio.h> int ma...转载 2019-03-22 09:55:36 · 2853 阅读 · 0 评论 -
sizeof针对不同输入的区别
转载于:https://blog.csdn.net/prokgtfy9n18/article/details/68962512 在数组运算前,先了解一下数组的解引用到底是怎么回事。 #include <windows.h>#include <stdio.h>int main(){ int arr[] = {1,2,3,4,5,6,7,8,9,0}; printf("%d...转载 2019-04-03 22:08:42 · 220 阅读 · 0 评论 -
C++ string c常用操作
转载于:https://blog.csdn.net/qq_37941471/article/details/82107077 一. ...转载 2019-08-01 11:39:42 · 3050 阅读 · 1 评论