
c语言
老醋
这个作者很懒,什么都没留下…
展开
-
typedef用法
出处:http://www.cnblogs.com/charley_yang/archive/2010/12/15/1907384.html第一、四个用途 用途一: 定义一种类型的别名,而不只是简单的宏替换。可以用作同时声明指针型的多个对象。比如:char* pa, pb; // 这多数不符合我们的意图,它只声明了一个指向字符变量的指针, // 和一个字符变量;以下则可行:转载 2015-10-09 09:24:59 · 338 阅读 · 0 评论 -
c语言中数组与sizeof()
我以前的理解是:数组名字就是指向数组首元素的指针,然而用sizeof()操作数组名字,把我又弄得有些疑惑了。查了查资料,终于明白了。原来,数组名字做形参时才被当作指针。而sizeof()并不是一个函数,而是一个单目运算符,所以sizeof()里写数组名字,返回的就是数组占了多少字节。例如: char a[10] = {1,2,3};sizeof(a) = 10;原创 2016-03-05 21:56:46 · 663 阅读 · 0 评论 -
数组指针的理解
int(*p)[n]形式,定义p为指向长度为n的int型一维数组例如:int a[5] = {1,2,3,4,5};int(*p)[5] = &a;*p即等价a,a为指向第一个元素的指针,即a为&a[0],在此处为int型指针,所以访问数组元素可以用a[i]、*(a+i)或*p[i]、*(*p+i)。相似的,二维数组形式相似。例如:int a[2]原创 2016-02-28 18:27:26 · 435 阅读 · 0 评论 -
LeetCode: Largest Rectangle in Histogram
Given n non-negative integers representing the histogram's bar height where the width of each bar is 1, find the area of largest rectangle in the histogram.Above is a histogram where width o原创 2016-08-27 20:01:58 · 427 阅读 · 0 评论 -
线程特定数据
线程特定数据创建使用,简单例子,在别人小例子上修改原创 2016-07-28 22:09:13 · 315 阅读 · 0 评论 -
leetcode Permutation Sequence
The set [1,2,3,…,n] contains a total of n! unique permutations.By listing and labeling all of the permutations in order,We get the following sequence (ie, for n = 3):"123""132""213""231""3原创 2016-08-21 18:44:30 · 313 阅读 · 0 评论