摘要:
一、一个由C/C++编译到程序占用的内存分为以下几个部分: 1、栈区(stack)——由编译器自动分配释放,在不需要的时候自动清除。用于存放函数的参数、局部变量等。操作方式类似数据结构中的栈(后进先出)。 2、堆区(heap)——一般由程序员分配释放,若程序员分配后不释放,程序结束后可能由OS回收。 阅读全文
posted @ 2017-06-14 16:05
鸭子船长
阅读(324)
评论(0)
推荐(0)
摘要:
参考一: 有关C/C++指针的经典面试题 有关C/C++指针的经典面试题 0.预备知识,最基础的指针 其实最基础的指针也就应该如下面代码: int a; int* p=&a; 也就是说,声明了一个int变量a,然后声明一个int 的指针,*p指向a的地址,&也就是取地址符号,而*是指针中取内容的符号 阅读全文
posted @ 2017-06-14 15:46
鸭子船长
阅读(1180)
评论(0)
推荐(0)
摘要:
有些信息在存储时,并不需要占用一个完整的字节, 而只需占几个或一个二进制位。例如在存放一个开关量时,只有0和1 两种状态, 用一位二进位即可。为了节省存储空间,并使处理简便,C语言又提供了一种数据结构,称为“位域”或“位段”。所谓“位域”是把一个字节中的二进位划分为几个不同的区域, 并说明每个区域的 阅读全文
posted @ 2017-06-14 15:43
鸭子船长
阅读(222)
评论(0)
推荐(0)
摘要:
Given a binary tree, determine if it is height-balanced. For this problem, a height-balanced binary tree is defined as a binary tree in which the dept 阅读全文
posted @ 2017-06-14 15:18
鸭子船长
阅读(235)
评论(0)
推荐(0)
摘要:
I、Given a binary tree and a sum, determine if the tree has a root-to-leaf path such that adding up all the values along the path equals the given sum. 阅读全文
posted @ 2017-06-14 12:33
鸭子船长
阅读(132)
评论(0)
推荐(0)
摘要:
数组指针(也称行指针)定义 int (*p)[n];()优先级高,首先说明p是一个指针,指向一个整型的一维数组,这个一维数组的长度是n,也可以说是p的步长。也就是说执行p+1时,p要跨过n个整型数据的长度。 如要将二维数组赋给一指针,应这样赋值:int a[3][4];int (*p)[4]; // 阅读全文
posted @ 2017-06-14 11:02
鸭子船长
阅读(199)
评论(0)
推荐(0)
摘要:
Given a string S and a string T, count the number of distinct subsequences ofT inS. A subsequence of a string is a new string which is formed from the 阅读全文
posted @ 2017-06-14 00:00
鸭子船长
阅读(3017)
评论(0)
推荐(0)