易截截图软件、单文件、免安装、纯绿色、仅160KB

c/c++的知识点收集

1.动态获得内存的代码:
void GetMemory(char **p, int num)
{
  *p = (char *)malloc(sizeof(char) * num);
}
char* GetMemory2(int num)
{
  char* p = (char *)malloc(sizeof(char) * num);
  return p;
}
------------------------------------------
错误的代码:
void GetMemory3(char *p, int num)
{
  p = (char *)malloc(sizeof(char) * num);
}///////////////错误在哪里,我就不说,自己去查.
2.strcpy()的代码:
char* strcpy(char* strDest,const char* strSrc)
{
    if(strDest==NULL || strSrc==NULL)      return NULL;
    char* pStr=strDest;
    while((*strDest++=*strSrc++)!='\0)
          NULL;
    return pStr; 
}
3.memcpy()的代码:
void* memcpy(char* strDest,const char* strSrc,size_t size)
{
    if(strDest==NULL||strSrc==NULL) return NULL;
    if(size <=0) return NULL;   
    char* pStr=strDest;
    while(size-->0)
        *strDest++=*strSrc++;
    return pStr;   
}
4.关于sizeof操作符:
char                                1
short                               2
short    int                       2
signed short                    2
unsigned short                2
int                                   4
long   


相关文档:

VC++,Java到底该学那个?

现在很多人都问 C++和Java 哪个好. 其实技术上各有各的好处与不足,我想大家所说的好不好指得是前途好不好,赚的多不多.
 要说赚钱最多的肯定是C++了.因为一门技术是否值钱全看会它的人有多少而不在于这个技术本身的好坏. C++涉及硬件底层的东西比较多,学起来很复杂,会的人少,所以值钱. 
&nb ......

mysql connect by c++

#include <stdio.h>
#include <windows.h>
#include <mysql.h>
#define host "localhost"
#define username "root"
#define password "123"
#define database "oa"
MYSQL *conn;
int main()
{
MYSQL_RES *res_set;
MYSQL_ROW row;
unsigned int i,ret;
FILE *fp;
MYSQL_FIELD *field; ......

Delphi 与 C/C++ 数据类型对照表

Delphi 与 C/C++ 数据类型对照表
Delphi数据类型C/C++
ShorInt
8位有符号整数
char
Byte
8位无符号整数
BYTE,unsigned short
SmallInt
16位有符号整数
short
Word
16位无符号整数
unsigned short
Integer,LongInt
32位有符号整数
int,long
Cardinal,LongWord/DWORD
32位无符号整数
unsigned long
Int6 ......

C/C++/Java for语句规范写法浅析(二重及以上循环)

 举个简单例子:用二重循环输出1-100 数字;
 当然我这里是举例子针对二重及以上的循环,
完全可以使用单循环,于是便飞快的完成了以下
 代码:
  如下就用C/C++举例。
 C++代码(VS2008):
#include "stdafx.h"
#include <iostream>
using namespace std;
int _tmain(in ......
© 2009 ej38.com All Rights Reserved. 关于E健网联系我们 | 站点地图 | 赣ICP备09004571号