zoukankan      html  css  js  c++  java
  • 剑指offer(纪念版)读书笔记【实时更新】

    C++

    1.STL的vector每次扩充容量,新容量是前一次的两倍。

    2.32位机指针大小为4个字节,64位机指针大小为8个字节。

    3.当数组作为函数参数传递时,数组会自动退化成同类型指针。

    4.

    "0123456789"占11个字节,因为有''。
    如果定义char a[10]; 
    strcpy(str,"0123456789");// 将会导致字符串越界。

     5.

    //定义数组为先申请空间,再把内容复制到数组中
    char str1[] = "hello world";
    char str2[] = "hello world";

    //定义指针时为将内容放在一个固定内存地址,所以str3和str4只想同一个"hello world"
    char* str3 = "hello world";
    char* str4 = "hello world";

    //比较的是地址,如果要比较内容需要调用库函数
    if(str1 == str2){
    cout << "str1 == str2" << endl;
    }else{
    cout << "str1 != str2" << endl;
    }

    if(str3 == str4){
    cout << "str3 == str4" << endl;
    }else{
    cout << "str3 != str4" << endl;
    }

    输出结果为:

    6.

  • 相关阅读:
    mac前端解除端口占用命令
    Mac安装Brew
    Mac Webstrom 快捷键
    linux yarn安装
    js-新兴的API,最佳实践,离线应用于客户端存储
    js-高级技术
    js-Ajax与Comet
    js-错误处理与调试,JSON
    js-DOM2,表单脚本
    js-事件
  • 原文地址:https://www.cnblogs.com/zhangjiuding/p/7467846.html
Copyright © 2011-2022 走看看