C/C++ ±Ê¼Ç£¨ÁãËéµã£©
1£©a = a + 5; Óë a += 5£»µÄÇø±ð¡£
¶þÕßÔÚ¹ãÒåÉÏÊǵȼۡ£D.Ritchie ÔÚCÓïÑÔÖÐÒýÈ븴ºÏÔËËã·ûµÄÖ÷ҪĿµÄÊÇΪÁËÌá¸ß±àÒëµÄЧÂÊÒÔ²úÉú¸ßÖÊÁ¿µÄÖ´ÐдúÂë¡£ÒòΪÕâЩÔËËã·ûµÄ¹¦ÄÜ»ù±¾É϶¼ÄÜÓÃÒ»¶þÌõ»úÆ÷Ö¸ÁîÀ´Íê³É¡£
2£©ÔÚC++ÖÐlong Óë int µÄÇø±ð
NameDescriptionSize*Range*
char
Character or small integer.
1byte
signed: -128 to 127
unsigned: 0 to 255
short int
(short)
Short Integer.
2bytes
signed: -32768 to 32767
unsigned: 0 to 65535
int
Integer.
4bytes
signed: -2147483648 to 2147483647
unsigned: 0 to 4294967295
long int
(long)
Long integer.
4bytes
signed: -2147483648 to 2147483647
unsigned: 0 to 4294967295
bool
Boolean value. It can take one of two values: true or false.
1byte
true or false
float
Floating point number.
4bytes
+/- 3.4e +/- 38 (~7 digits)
double
Double precision floating point number.
8bytes
+/- 1.7e +/- 308 (~15 digits)
long double
Long double precision floating point number.
8bytes
+/- 1.7e +/- 308 (~15 digits)
wchar_t
Wide character.
2 or 4 bytes
1 wide character
Òò´ËÔÚÕâÀï¿ÉÒÔ¿´³ölongÓëintÊÇûÓÐÇø±ðµÄ¡£
µ«ÊÇ£¬ÔÚÓ¡ÏóÖÐlongÓëint»¹ÊÇÓÐÇø±ðµÄ£¬Ó¦¸ÃÊÇÔÚ±íʾµÄ·¶Î§ÄÚÓвî±ð£¬ÕâÊÇΪʲô£¿
°Ý°ÝGoogle´óÉñÖ®ºóµÃµ½Ò»¸ö±È½ÏÂúÒâµÄ½á¹û£º
integer ·Ölong integer ºÍ short integer Á½ÖÖ£¬ÊÓ²»Í¬µÄ±àÒëÆ÷£¬µ¥µ¥integer ±íʾ²»Í¬µÄÊý¾ÝÀàÐÍ¡£
ÔÚtc Àïint ĬÈÏΪÁ½¸ö×Ö½Ú£¬·¶Î§ÔÚ-32768¡«32767£»¶øÔÚvcÀïĬÈÏΪ4 ¸ö×Ö½Ú£¬·¶Î§ÔÚ-2147483648¡«2147483647.
long ×ÜÊDZíʾ4 ¸ö×Ö½ÚµÄÊý¾Ý¡£
3£©struct¶ÔÏóµÄ´óС¼ÆË㣺
struct address
{
char* name;
long int number;
char* street;
char* town;
char state[2];
long zip;
};
½á¹¹ÀàÐͶÔÏóµÄ´óСδ±ØÊÇÆä³ÉÔ±µÄ´óС֮ºÍ£¬ÕâÊÇÒòΪºÜ¶à»úÆ÷ÒªÇó½«È·¶¨ÀàÐ͵ĶÔÏó·ÖÅäÔÚijÖÖÓë»úÆ÷µÄϵͳÏà¹ØµÄ±ß½çÉÏ£¬»òÕßÊÇÔÚ²ÉÓÃÊʵ±·ÖÅäµÄÒªÇóÏÂÄܸüÓÐЧµÄ´¦ÀíÕâЩ¶ÔÏó¡£
unionºÍstructÀàÐ͵ĴóС¼ÆËã:
¶ÔÓÚunion£¬¶ÔÆëµÄ´óСÊÇ×î´óµÄ»ù±¾ÔªËصĶÔÆë´óС£¬¶ÔÏóµÄ´óС±ØÐëÊǸûù±¾ÔªËØ´óСµÄÕûÊý±¶¡£
Èç:
Union U1
{
char a[9];
 
Ïà¹ØÎĵµ£º
VB
If MSComm1.PortOpen = True Then MSComm1.PortOpen = False
MSComm1.CommPort = i1
MSComm1.PortOpen = True
MSComm1.InputMode = comInputModeBinary
MSComm1.InBufferCount = 0
& ......
ÏÂÃæÁоÙÁËһЩ³£¼ûµÄ±àÒëÆ÷µÄµ÷ÓÃÔ¼¶¨
VC6:
µ÷ÓÃÔ¼¶¨ ¶ÑÕ»Çå³ý ²ÎÊý´«µÝ
__cdecl µ÷ÓÃÕß ´ÓÓÒµ½×ó,ͨ¹ý¶ÑÕ»´«µÝ
__stdcall º¯Êý ......
¹þ¹þ£¡ÓÐÐÒÔÚijÍøÕ¾·¢ÏÖÕâƪÎÄÕ£¬¶Á°Õ£¬¾õµÃÂùÓеÀÀí£¬·¢À´´ó¼ÒÒ»Æð¹²ÃãÖ®
×ÜÊDZ»Í¬Ñ§ÃÇÎʵ½£¬ÈçºÎѧϰCºÍC++²Å²»Ã£È»£¬²Å²»ÊÇÂÒѧ£¬ÏëÁËһϣ¬ÕâÀï¸ø³öÒ»¸ö×ܵĻظ´¡£
¡¡¡¡Ò»¼ÒÖ®ÑÔ£¬»¶ÓÅÄש¹þ¡£
¡¡¡¡1¡¢¿ÉÒÔ¿¼ÂÇÏÈѧϰC.
¡¡¡¡´ó¶àÊýʱºò£¬ÎÒÃÇѧϰÓïÑÔµÄÄ¿µÄ£¬²»ÊÇΪÁ˳ÉΪһ¸öÓïÑÔר¼Ò£¬¶øÊÇÏ£Íû ......
#include “stdio.h”
#include “stdlib.h”
#include “time.h”
int main( void )
{
long i = 10000000L;
clock_t start, finish;
double duration;
/* ²âÁ¿Ò ......
1.ÏÂÃæÄÄÖÖ´úÂë·ç¸ñ¸üºÃ£¬why£¿
A . if ('A' == a)
{a++;}
B. if( a == 'A')
{a++;}
´ð°¸£ºA£¬Èç¹û°Ñ==´íд³É=£¬ÒòΪ±àÒëÆ÷²»ÔÊÐí¶Ô³£Á¿¸³Öµ£¬ÈÝÒײî´í¡£
2.#define MUTI(x) (x*x)
int i=3,j, ......