在用二维数组名作为参数传递时容易出现Segmention Error。这是因为不能正确为二维数组中元素寻址的问题,正确的方法如下:
[cpp] view
plaincopy
#include
#include
#define N 4
void testArray(int *a, int m, in...
分类:
编程语言 时间:
2015-04-16 12:31:50
阅读次数:
134
前段时间 遇到 listview 和scrollview 布局的问题 ,现在提供一个解决方案 if (listAdapter == null || listAdapter.getCount() == 0) {
return;
}
int totalHeight = 0;...
分类:
移动开发 时间:
2015-04-16 12:29:04
阅读次数:
131
函数原型
#include
void qsort(void *base, size_t nmemb, size_t size, int(*compar)(const void *, const void *));
参数说明:
base:排序数组的起始地址
nmemb:要排序的元素的个数
size:单个元素的大小
compar:用户自定义的比较两个元素大小的方法。
int(*co...
分类:
系统相关 时间:
2015-04-16 12:27:38
阅读次数:
193
头文件:using ElementType = int;
#define MaxSize 100
struct SeqList{
ElementType data[MaxSize];
int length; /*the size of the seqlist */
};
using PtrList = SeqList*;
using Position = int;
using Le...
分类:
其他好文 时间:
2015-04-16 12:27:17
阅读次数:
213
Given an array of integers, every element appearstwiceexcept for one. Find that single one. 1 class Solution { 2 public: 3 int singleNumber(int A[...
分类:
其他好文 时间:
2015-04-16 12:22:41
阅读次数:
93
1 #include 2 #include 3 using namespace std; 4 5 6 int main() 7 { 8 string str("some thing"); 9 for(auto &c:str)10 if(!isspace(c)...
分类:
其他好文 时间:
2015-04-16 12:19:40
阅读次数:
91
快速排序与归并排序相比,同样是递归,归并算法是递归分解数组之后再合并,而快速排序递归分解数组之前已经进行合并。#includeint W_K_T_S(int a[] , int first , int last) { // 确定基准数并调整相应位置 int te...
分类:
编程语言 时间:
2015-04-16 12:19:19
阅读次数:
163
描述:给出一个单词,在单词中插入若干字符使其为回文串,求回文串的个数(|s|#include#include#includeusing namespace std;#define maxn 410#define mod 10007typedef int ll;struct marix{ int...
分类:
其他好文 时间:
2015-04-16 12:18:58
阅读次数:
219
分页存储过程:CREATE PROCEDURE [dbo].[getData] -- Add the parameters for the stored procedure here@tb varchar(150),@status varchar(800),@indexpage int,@endpa...
分类:
数据库 时间:
2015-04-16 12:17:15
阅读次数:
154
getDimension和getDimensionPixelOffset的功能类似,都是获取某个dimen的值,但是如果单位是dp或sp,则需要将其乘以density如果是px,则不乘。并且getDimension返回float,getDimensionPixelOffset返回int.而getDi...
分类:
其他好文 时间:
2015-04-16 12:07:24
阅读次数:
161