共 18 篇文章 |
|
阅35 转1 评0 公众公开 11-09-05 10:14 |
GDB命令在linux的c编程中大家经常用gdb调试程式,以下是一些常用的指令。在地址ADDRESS上设置断点,这个命令允许你在没有调试信息的程式中设置断点。设置第BNUM号断点的被忽略的次数为''COUNT'',即断点BNUM再执行到第COUNT+1.一个断点,在新设置断点时,先删除原断点。条件断点,当这个命令完成时显示所有被设置的断点信息。... 阅793 转1 评0 公众公开 11-03-21 22:18 |
作者:wstruecolor unix下开发常用的编译工具gcc,我对于gcc的了解知道的很少, 一般用到的也就是gcc -o xx xx.cpp 今天翻了一下gnu的gcc manual 花了点时间总结了一下, 给大家分享一下!file.h c/c++豫编译头文件. file.cc file.cp file.cxx file.cpp file.CPP file.c++ file.C c++源文件要经过豫处理. file.hh file.H c++头文件转换为豫处理头... 阅58 转自jollyme 公众公开 11-03-21 22:14 |
变量存储 作用域:变量名有效的范围 存在期:变量在程序中存在的时期. 存储方式:auto, register, extern, static 存储空间类型: 栈(stack):自动分配和清除的变量.如:局部变量和函数参数等 堆(heap):由malloc等函数分配的空间. (在c++里这叫自由存储区,而把new得来的空间叫做堆) 全局/静态存储区:存储全局变量和静态变量. ... 阅228 转2 评0 公众公开 11-03-19 21:32 |
Node* head = new Node(0);Node* tail = head ;Node* p = new Node(i);tail->next = _next;tail->next = _next ;tail=tail->next;node(int x):data(x),next(0){} int data;node* reverse(node* head){node* __next=head->next;node* head=new node(0);node* tail=head;i++) { node* p=new node(i);head=head->next; 阅242 转4 评0 公众公开 11-03-19 21:14 |
建立Socket.my_addr.sin_addr.s_addr = inet_addr("210.45.64.222");面向连接的客户程序使用connect函数来配置socket并与远端服务器建立一个TCP连接,其函数原型为:int connect( int sockfd, struct sockaddr_in *serv_addr,int addrlen);send()函数原型为: int send(int sockfd, const void *ms... 阅758 转6 评0 公众公开 11-03-19 21:11 |
static函数与普通函数有什么区别:static函数在内存中只有一份,普通函数在每个被调用中维持一份拷贝。函数外的str是一个静态定义的数组,因此其大小为6,函数内的str实际只是一个指向字符串的指针,没有任何额外的与数组相关的信息,因此sizeof作用于上只将其当指针看,一个指针为4个字节,因此返回4。int (*s[10])(int) 函数指针数组,每个指... 阅110 转1 评0 公众公开 11-03-18 10:49 |
快拍#include <iostream>using namespace std;int arr[10]={1,2,3,4,5,6,7,8,9,0};int partition(int * arr,int p,int r){int x=arr[r];int tmpX=arr[j];arr[j]=arr[i];arr[i]=tmpX;} } int tmpX=arr[r];arr[r]=arr[i+1];}void matrixQuickSort(int * arr,int p,int r){if(p<r) { int q=partition(arr,p,r); 阅49 转0 评0 公众公开 11-03-17 12:04 |
和#include "stdio.h" void main () { int n; long sum=0,s=1; for(n=1;n<=20;n++) { s=s*n; sum=sum+s; } printf("%ld\n",sum); } #include "iostream"using namespace std;int main() { int sum=0,i=1,n=1; while(i<=20) { n=n*i; sum=sum+n; i++; } cout... 阅91 转0 评0 公众公开 11-03-17 11:15 |