![](https://img-blog.csdnimg.cn/20201014180756754.png?x-oss-process=image/resize,m_fixed,h_64,w_64)
c/c++
robert_zhai
Life is short, cherish what we have owned !
My github is https://robertzhai.github.io 。
展开
-
产生随机整数序列
void generate(int *arr,int num) { srand((int)time(0)); for(int i= 0; i arr[i] = rand(); }}原创 2012-12-26 19:52:54 · 498 阅读 · 0 评论 -
一元操作符重载
//============================================================================// Name : class_point.cpp// Author : // Version :// Copyright : Your copyright notice// Descri原创 2013-01-02 23:17:18 · 389 阅读 · 0 评论 -
friend function
//============================================================================// Name : friend.cpp// Author : // Version :// Copyright : Your copyright notice// Description原创 2013-01-03 16:27:17 · 282 阅读 · 0 评论 -
c static libarary create
// fred.c#includevoid fred(int arg){ printf("fred: we passed %d\n", arg);}// bill.c#includevoid bill(char *arg) { printf("bill: we passed %s\n", arg);}//program.c原创 2013-01-13 15:39:42 · 271 阅读 · 0 评论 -
信号函数
转载 2013-02-02 22:57:55 · 314 阅读 · 0 评论 -
C++中SYSTEM的用法
C++中SYSTEM的用法曾经的曾经,被system()函数折磨过,之所以这样,是因为对system()函数了解不够深入。只是简单的知道用这个函数执行一个系统命令,这远远不够,它的返回值、它所执行命令的返回值以及命令执行失败原因如何定位,这才是重点。当初因为这个函数风险较多,故抛弃不用,改用其他的方法。这里先不说我用了什么方法,这里必须要搞懂system()函数,因为还是有转载 2013-03-23 17:36:57 · 838 阅读 · 0 评论 -
淘宝网络框架tbnet源码分析
http://blog.yunnotes.net/index.php/read_tbnet_code_again/转载 2013-12-06 19:30:53 · 2357 阅读 · 0 评论 -
array left shift
#include void print(int arr[], int n) { for(int i=0; i < n; i++){ printf("%d ", arr[i]); } printf("\n");}void reverse(int *arr ,int start, int end) { while(start < end) { int temp原创 2013-12-14 11:16:39 · 594 阅读 · 0 评论 -
c函数指针详解
c函数指针详解创建时间:2014-9-24 15:36 修改时间:2014-10-20 9:52 c函数指针详解一 通常的函数调用 一个通常的函数调用的例子://自行包含头文件void MyFun(int x); //此处的申明也可写成:void MyFun(转载 2014-10-20 09:56:29 · 461 阅读 · 0 评论 -
通过指针的指针来实现传出参数
c 中所有对象包括指针都是“复制传值”,指针也不例外,可以通过指针的指针来实现传出参数,如下。#include#includevoid test(int **x) { int *p = malloc(sizeof(int)); *p = 123456; *x = p;}int main() { int *p; test(&原创 2014-12-10 22:26:49 · 684 阅读 · 0 评论 -
overload
//============================================================================// Name : overload.cpp// Author : // Version :// Copyright : Your copyright notice// Descripti原创 2013-01-02 22:23:29 · 352 阅读 · 0 评论 -
c++ stl bitset 位图操作
/* * bitset.cpp * * Created on: 2013-1-1 * Author: Administrator */#include#include#include#include#include#includeusing namespace std;#define MAX_SIZE 1000原创 2013-01-01 17:39:35 · 1613 阅读 · 0 评论 -
标准strcpy函数
分析:如果编写一个标准strcpy函数的总分值为10,下面给出几个不同得分的答案://2分 void strcpy( char *strDest, char *strSrc ) { while( (*strDest++ = * strSrc++) != '/0' ); } //4分 void strcpy( char *strD转载 2013-01-01 13:59:38 · 443 阅读 · 0 评论 -
itoa 实现
/* 实现itoa函数的源代码 */ char *myitoa(int num,char *str,int radix) { itoa流程图/* 索引表 */ char index[]="0123456789ABCDEFGHIJKLMNOPQRSTUVWXYZ"; unsigned unum; /* 中间变量 *转载 2013-01-01 18:08:46 · 354 阅读 · 0 评论 -
单向链表操作
#include #include #include#includeusing namespace std;typedef struct Node{ int data; Node * next; }node;void print(node *head) { node *p = head; whil原创 2012-12-31 20:24:09 · 234 阅读 · 0 评论 -
字符串循环右移动K位
/* * shift.cpp * * Created on: 2013-1-1 * Author: Administrator */#include#includevoid reverse(char *p,int begin,int end) {char tmp ;while(begintmp = p[begin];p[b原创 2013-01-01 12:56:53 · 489 阅读 · 0 评论 -
Powering a number
//============================================================================// Name : an_square.cpp a的n次方// Author : // Version :// Copyright : Your copyright notice// De原创 2013-01-02 16:26:35 · 374 阅读 · 0 评论 -
构造与析构
//============================================================================// Name : class_point.cpp// Author : // Version :// Copyright : Your copyright notice// Descri原创 2013-01-02 23:09:51 · 272 阅读 · 0 评论 -
二元操作符重载
//============================================================================// Name : class_point.cpp// Author : // Version :// Copyright : Your copyright notice// Descri原创 2013-01-02 23:32:29 · 311 阅读 · 0 评论 -
c 局部申请内存
#include #include using namespace std;void GetMemory(char **p, int num) { *p = (char*)malloc(num*sizeof(char)); }char * GetMemory2(char *p,int num) { p = (char*)mallo原创 2012-12-31 17:37:15 · 401 阅读 · 0 评论 -
内存布局
静态区:保存自动全局变量和static 变量(包括static 全局和局部变量)。静态区的内容在总个程序的生命周期内都存在,由编译器在编译的时候分配。栈:保存局部变量。栈上的内容只在函数的范围内存在,当函数运行结束,这些内容也会自动被销毁。其特点是效率高,但空间大小有限。堆:由malloc 系列函数或new 操作符分配的内存。其生命周期由free 或delete 决定。在没转载 2012-12-31 17:45:05 · 238 阅读 · 0 评论 -
整数建散列表
#include #include #include#includeusing namespace std;typedef struct Hash_Node { int data; int count; Hash_Node * next;}node; #define HASH_SIZE 1024node *hash_ta原创 2012-12-31 21:08:46 · 329 阅读 · 0 评论 -
《C语言点滴》- 总结
补一下c语言基础知识,看了下,指针部分总结的很好,不过内容少了些。下载地址:github 下载原创 2016-10-30 08:18:44 · 423 阅读 · 0 评论