原创 va_list、va_start、va_arg、va_end的原理與使用 (轉)

概述 由於在C語言中沒有函數重載,解決不定數目函數參數問題變得比較麻煩;即使採用C++,如果參數個數不能確定,也很難採用函數重載.對這種情況,有些人採用指針參數來解決問題.下面就c語言中處理不定參數數目的問題進行討論. 定義 大家先看幾

原创 內存對齊 _INTSIZEOF(n)

問: #define _INTSIZEOF(n)  ((sizeof(n)+sizeof(int)-1)&~(sizeof(int) - 1) )

原创 圖深度優先遍歷(遞歸和棧實現)

/* depth-first traversal * two methods: recursive and non-recursive * Graph is stored in an adjacency matrix */ #in

原创 內存分配算法-(首次分配法和最佳分配法)

/* implement a memory allocation scheme by using algorithms first-fit, next-fit, and best-fit * freelist爲空閒區鏈表的頭,它的下一個

原创 統計輸入中關鍵詞出現的次數(二分查找實現)

/* 統計輸入的c語言中關鍵詞出現的次數 * @method: 使用二分查找實現,keytab[]關鍵詞必須是按首字母排好序的關鍵詞表 */ #include<stdio.h> #include<stdlib.h> #include

原创 從問題看本質:socket到底是什麼?

一、問題的引入——socket的引入是爲了解決不同計算機間進程間通信的問題 1.socket與進程的關係 1).socket與進程間的關係:sock

原创 binary tree(basic operation)

/** @author: yj * time: 2012/4 * usage: basic function for binary tree */ #include "tree.h" #include <stdio.h>

原创 Need to write down something

I have been finding a  job for around one month, with several offers in hand. It is really hard to decide which job I s

原创 堆排序

#include<stdio.h> #include<stdlib.h> void swap(int *x, int *y) { int temp; temp = *x; *x = *y; *y = temp; } /* aj

原创 統計輸入中所有單詞出現的次數(使用二叉查找樹實現:遞歸和非遞歸)

/*@function:統計輸入中的所有單詞出現的次數 * @method: 使用二叉查找樹。對輸入的單詞建立一顆二叉查找樹,新輸入的單詞若存在於樹中,則增加該節點的計數值;否則,新增一個節點 */ #include<stdio.h>

原创 summary

  Time flies, and a week has past. Kyle gave me the advice that i needed to do more coding.  So i made up my mind to wr

原创 void及void指針含義的深刻解析

void的含義     void即“無類型”,void *則爲“無類型指針”,可以指向任何數據類型。 void指針使用規範     ①void指針可以指向任意類型的數據,亦即可用任意數據類型的指針對void指針賦值。例如:     in

原创 二叉查找樹

/* binary search tree * 1. Any node in the left subtree is less than the root; * 2. Any node in the right subtree is

原创 HTTP協議詳解

轉http://www.cnblogs.com/TankXiao/archive/2012/02/13/2342672.html 當今web程序的開發技術真是百家爭鳴,ASP.NET, PHP, JSP,Perl, AJAX 等等。 無論

原创 驅動開發學習路徑

1、編寫hello模塊,學會基本的流程,能看到輸出; 2、寫一完整驅動, 加上read, write, ioctl, polling等各種函數的驅動實現,在ioctl裏完成從用戶空間向內核空間傳遞結構體的實現。 3、 寫一block驅動,