![](https://img-blog.csdnimg.cn/20201014180756928.png?x-oss-process=image/resize,m_fixed,h_64,w_64)
C/C++
文章平均质量分 60
Cuphrody
这个作者很懒,什么都没留下…
展开
-
C++项目中的extern "C" {}
引言 在用C++的项目源码中,经常会不可避免的会看到下面的代码: 1 2 3 4 5 6 7 8 9 #ifdef __cplusplus extern "C" { #endif /*...*/ #ifdef __cplusplus }转载 2014-03-10 16:03:06 · 466 阅读 · 0 评论 -
Longest Palindromic Substring
Given a string S, find the longest palindromic substring in S. You may assume that the maximum length of S is 1000, and there exists one unique longest palindromic substring. Have原创 2014-08-08 16:03:09 · 340 阅读 · 0 评论 -
String to Integer (atoi)
Implement atoi to convert a string to an integer. Hint: Carefully consider all possible input cases. If you want a challenge, please do not see below and ask yourself what are the possible input case原创 2014-08-06 16:43:53 · 322 阅读 · 0 评论 -
Spiral Matrix
Given a matrix of m x n elements (m rows, n columns), return all elements of the matrix in spiral order. For example, Given the following matrix: [ [ 1, 2, 3 ], [ 4, 5, 6 ], [ 7, 8, 9 ] ] You原创 2014-07-30 14:45:28 · 383 阅读 · 0 评论 -
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 a target value to search. If found in the array return it原创 2014-07-29 16:32:40 · 310 阅读 · 0 评论 -
Two Sum
Given an array of integers, find two numbers such that they add up to a specific target number. The function twoSum should return indices of the two numbers such that they add up to the target, where原创 2014-07-28 15:39:49 · 351 阅读 · 0 评论 -
STL萃取
这个萃取着实不是很好理解,今天自己写了一段代码以至于自己都改了半天才输出想要的额济国原创 2014-04-05 20:29:23 · 618 阅读 · 0 评论 -
C语言结构体里的成员数组和指针
单看这文章的标题,你可能会觉得好像没什么意思。你先别下这个结论,相信这篇文章会对你理解C语言有帮助。这篇文章产生的背景是在微博上,看到@Laruence同学出了一个关于C语言的题,微博链接。微博截图如下。我觉得好多人对这段代码的理解还不够深入,所以写下了这篇文章。 为了方便你把代码copy过去编译和调试,我把代码列在下面: 1 2 3 4 5 6转载 2014-04-05 10:11:48 · 612 阅读 · 0 评论 -
windows环境下static变量的初始化
前几天有看到这么一个问题 说 c++中 static变量的初始化是什么时候, 和室友讨论了一下无果 做了一下实验,发现了一些结论。 如果声明了一个static变量,但是没给这个变量赋值, 然后程序运行的时候也没有调用这个static变量,那么这个static变量实际上并没有被分配内存空间,也没有初始化,而被赋予处置了的static变量在main函数执行之前其实就已经分配了内存空间,下图所示变量b原创 2014-03-17 21:10:16 · 795 阅读 · 1 评论