摘要:
原型:extern void *memcpy(void *dest, void *src, unsigned int count); 用法:#include <string.h> 功能:由src所指内存区域复制count个字节到dest所指内存区域。 说明:src和dest所指内存区域不能重叠,函数返回指向dest的指针。 举例: // memcpy.c #include <syslib.h> #include <string.h> main() { char *s="Golden Global View"; char d[20]; cl 阅读全文
posted @ 2011-06-23 15:34
為愛西行
阅读(140)
评论(0)
推荐(0)
摘要:
原型:extern char *strstr(char *haystack, char *needle); 用法:#include <string.h> 功能:从字符串haystack中寻找needle第一次出现的位置(不比较结束符NULL)。 说明:返回指向第一次出现needle位置的指针,如果没找到则返回NULL。 举例: // strstr.c #include <syslib.h> #include <string.h> main() { char *s="Golden Global View"; char *l="lo 阅读全文
posted @ 2011-06-23 15:30
為愛西行
阅读(124)
评论(0)
推荐(0)
摘要:
求组合数:求n个数(1....n)中k个数的组合....如:combination(5,3)要求输出:543,542,541,532,531,521,432,431,421,321#include <stdio.h>int pop(int *);int push(int );void combination(int, int );int stack[3] = {0};int top = -1;int main(){ int m, n; printf("Input two numbers:\n"); while( 2!=scanf("%d%*c%d&qu 阅读全文
posted @ 2011-06-23 13:51
為愛西行
阅读(256)
评论(0)
推荐(0)
摘要:
有一个数组a[1000]存放0--1000;要求每隔二个数删掉一个数,到末尾时循环至开头继续进行,求最后一个被删掉的数的原始下标位置。以7个数为例:{0,1,2,3,4,5,6,7}0-->1-->2(删除)-->3-->4-->5(删除)-->6-->7-->0(删除),如此循环直到最后一个数被删除。#include <stdio.h>#define MAX 3int main(){ int arr[MAX]; for(int i=0; i<MAX; ++i) //数组初始化 arr[i]=i; int count=0; in 阅读全文
posted @ 2011-06-23 09:56
為愛西行
阅读(135)
评论(0)
推荐(0)
浙公网安备 33010602011771号