[c++] 细节

  • 退格:printf("asdflkj 111")输出111flkj(https://blog.csdn.net/tyshtang/article/details/43677083)
  • 起始数字表示不同进制:十进制——1-9;八进制——0;十六进制——0x
  • vector erase后自动指向下一个元素
  • 浮点数表示形式:十进制(123.)(.123)(12.3);指数(123e3)(1.23e3)
  • 赋值运算符返回左值((a+=3)=8)
  • char类型长度为1字节
  • 数组未定义的元素默认值为0
  • 分析下面程序的结果?1,s分配空间后不再指向q
 1 #include<stdio.h>
 2 #include<stdlib.h>
 3 
 4 void fun(int *p1,int *p2,int *s){
 5     s = (int *)malloc(sizeof(int));
 6     *s = *p1+*p2;
 7     free(s);
 8 }
 9 int main() {
10 int a[2]={1,2},b[2]={40,50},*q = a;
11 fun(a,b,q);
12 printf("%d
",*q);
13 }
  • 构造函数——先基类后派生类;析构函数——先派生类后基类
原文地址:https://www.cnblogs.com/cxc1357/p/10812165.html