C和C++
李连毛
这个作者很懒,什么都没留下…
展开
-
char* 和 char[]的区别
以下内容均来自互联网,我只是知识的搬运工。出处:原博主博客 1. 问题介绍 问题引入: 在实习过程中发现了一个以前一直默认的错误,同样char *c = “abc”和char c[]=”abc”,前者改变其内容程序是会崩溃的,而后者完全正确。 程序演示:测试环境Devc++ 代码#include <iostream>using namespace std;main(){ cha转载 2016-08-16 09:48:49 · 391 阅读 · 0 评论 -
C++ typedef的用法
出处;原博主博客第一、四个用途用途一:定义一种类型的别名,而不只是简单的宏替换。可以用作同时声明指针型的多个对象。比如: char* pa, pb; // 这多数不符合我们的意图,它只声明了一个指向字符变量的指针, // 和一个字符变量; 以下则可行: typedef char* PCHAR; // 一般用大写 PCHAR pa, pb; // 可行,同时声明了两个指向字符变量的指针转载 2016-08-16 14:52:45 · 285 阅读 · 0 评论 -
[leetcode3] Longest Substring Without Repeating Characters
Longest Substring Without Repeating Characters最长不重复子串题目描述 Given a string, find the length of the longest substring without repeating characters. Examples: Given “abcabcbb”, the answer is转载 2016-09-18 21:41:20 · 320 阅读 · 0 评论 -
[leetcode26] Remove Duplicates from Sorted Array
Remove Duplicates from Sorted Array从有序数组中取出重复数字题目描述 Given a sorted array, remove the duplicates in place such that each element appear only once and return the new length. Do not allocate extra转载 2016-09-25 21:06:42 · 286 阅读 · 0 评论 -
[leetcode33] Search in Rotated Sorted Array
Search in Rotated Sorted Array在已经旋转的数组中搜索指定数字题目描述 Suppose a sorted array is rotated at some pivot unknown to you beforehand. (i.e., 0 1 2 4 5 6 7 might become 4 5 6 7 0 1 2). You are given转载 2016-09-27 21:11:13 · 306 阅读 · 0 评论