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
Ïà¹ØÎĵµ£º
ΪÁËʵÏÖÁ½¸öÊý×Ö½øÐн»»»£¬ÎÒÃÇͨ³£¿ÉÒÔÀûÓÃλÔËËãÀ´ÊµÏÖ
C++³ÌÐò swap(int a ,int b){a^=b^=a^=b;}
JAVA³ÌÐò swap(int a, int b){ a^=b;b^=a;a^=b; }»òÕß{ b^=(a^=b) ; a^=b;}
Èç¹ûJAVAÓÃC++µÄʵÏÖ·½Ê½Ôò»áµÃµ½ bµÃµ½ÁËaµÄÖµ£¬µ«ÊÇaÏÖÔÚµÄֵȴ² ......
#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;
......
µ±½ñÓÐÐí¶àÃâ·ÑµÄ RDBMS£¨Relational Database Management
System£¬¹ØÏµÊý¾Ý¿â¹ÜÀíϵͳ£©£¬ÆäÖÐһЩÊÇ¿ª·ÅÔ´ÂëÈí¼þ£¬ÁíһЩÊÇÉÌÒµ³§ÉÌÌṩµÄÃâ·Ñ²úÆ·¡£Èç¹ûÄúÕýÔÚʹÓà C/C++¡¢Java™¡¢.NET
»ò PHP
¿ª·¢Ó¦ÓóÌÐò£¬ÏëѰÕÒÒ»ÖÖ¿É¿¿µÄÊý¾Ý·þÎñÆ÷£¬Ï£ÍûËüÖ§³ÖÏȽøµÄ¼¼Êõ¡¢¾ßÓв»¶ÏÀ©´óµÄ¿ª·¢ÈËÔ±ÉçÇø²¢ÒѾ²¿ÊðÔÚÐí¶à¹Ø¼ ......
#include <iostream>
#include <stdio.h>
#include <stdlib.h>
#include ".\sqlite3_lib\sqlite3.h"
static int _callback_exec(void * notused,int argc, char ** argv, char ** aszColName)
{
int i;
for ( i=0; i<argc; i++ )
......
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 ......