摘要: 1 /*帕斯卡三角形(杨辉三角)*/ 2 int Recursive_Pascal_Triangle( int i, int j ) 3 { 4 if( (j == 0) || (i == j) ) 5 return 1; 6 else{ 7 ret... 阅读全文
posted @ 2015-02-27 22:18 永久指针 阅读(647) 评论(0) 推荐(0) 编辑
摘要: 1 /*递归形式的十进制数转化为二进制数*/ 2 void D2B( int n ) 3 { 4 if( n == 0 ) 5 return ; 6 else{ 7 D2B( n/2 ); 8 printf("%d",n%2); 9 ... 阅读全文
posted @ 2015-02-26 22:06 永久指针 阅读(440) 评论(0) 推荐(0) 编辑
摘要: 设计一个函数轮转字符串。例如将“abcd”转为"dabc"递归实现方式: 1 /*将字符串循环右移n个单位*/ 2 void move(char s[], int n) 3 { 4 if( n == 0) 5 return ; 6 else{ 7 in... 阅读全文
posted @ 2015-02-26 11:25 永久指针 阅读(620) 评论(0) 推荐(0) 编辑
摘要: The difference here is that : char *s = "hello,world!";will place hello,world in read-only part of the memmory and makes s a pointer to that. makin... 阅读全文
posted @ 2015-02-24 21:28 永久指针 阅读(121) 评论(0) 推荐(0) 编辑
摘要: 以前用C,习惯了define;const,enum 什么的基本不太会用,现在有时间整理一下。/*******************************************************************************************************... 阅读全文
posted @ 2015-02-24 20:37 永久指针 阅读(349) 评论(0) 推荐(0) 编辑
摘要: Ubuntu 14.04 (其他版本可能适用)浏览网页慢的一个重要原因是DNS默认为:172.0.0.1 查看/etc/resolv.conf 会看到他使用的dns是 nameserver 127.0.1.1 操作过程:修改/etc/resolv.conf, 将nameserver 改为你... 阅读全文
posted @ 2015-01-16 18:42 永久指针 阅读(637) 评论(0) 推荐(0) 编辑
摘要: 用malloc生成m*n的矩阵的两种方法: 1:使用指针数组 1 int** create_matrix(int m, int n) 2 { 3 int **mat = (int**) malloc (sizeof(int*) * m); 4 int i; 5 for(i=0... 阅读全文
posted @ 2014-06-02 18:10 永久指针 阅读(1859) 评论(0) 推荐(0) 编辑
摘要: 1 #include 2 3 /*从一个图象文件中生成 GdkPixbuf 类型数据*/ 4 GdkPixbuf * create_pixbuf(const gchar *filename) 5 { 6 GdkPixbuf *pixbuf; 7 GError *error = ... 阅读全文
posted @ 2014-05-27 10:17 永久指针 阅读(1769) 评论(0) 推荐(0) 编辑
摘要: 如果服务端的程序关闭后,端口不能马上释放掉,需要等一会才能小时,在这之间再启动服务程序是起不来的,但是可以用这个函数,边面这种情况,服务程序关闭后,可以马上再起一次,不会冲突了。listenfd = socket(AF_INET, SOCK_STREAM, 0);/* Enable addres... 阅读全文
posted @ 2014-05-26 21:03 永久指针 阅读(671) 评论(0) 推荐(0) 编辑
摘要: 1 #include 2 3 int main(int argc, char **argv) 4 { 5 GtkWidget *window; 6 gtk_init(&argc, &argv); 7 window = gtk_window_new(GTK_WINDOW_... 阅读全文
posted @ 2014-05-25 17:32 永久指针 阅读(261) 评论(0) 推荐(0) 编辑