Linux CÓïÑÔѧϰ±Ê¼Ç
1¡¢int 4×Ö½Ú
long 8×Ö½Ú
float 4×Ö½Ú
double 8×Ö½Ú
long double 16×Ö½Ú
2¡¢Ò»¸ö×Ö·û±äÁ¿Ö»ÄÜ´æ·ÅÒ»¸ö×Ö·û¡¢Ò»¸ö×Ö½Ú´æ·ÅÒ»¸ö×Ö½Ú
char c;
c = 'a'; c = '\034' c = '\n'
c = '\x65' c = 65 c = 0101
c = 0x41
3¡¢ÔËËã·û²Ù×÷
-i++µÈ¼ÛÓÚ-(i++)
i = 2;
j = -i++;
ÔËËã½á¹ûi=3 j=-2
4¡¢ÓÅÏȼ¶
!Âß¼·Ç > ËãÊõÔËËã·û > ¹ØϵÔËËã·û > &&Âß¼Óë > ||Âß¼»ò
a = 0; b = 1; c = 2; d = a++&&b++&&--c
µÈ¼ÛÓÚ
a = 0; b = 1; c = 2; d = (a++) && (b++) && (--c)
½á¹ûΪ
a = 1; b = 1; c = 2; d = 0;
a = 0; b = 1; c = 2; d = a++||b++||--c;
µÈ¼ÛÓÚ
a = 0; b = 1; c = 2; d = (a++) || (b++) || (--c);
½á¹ûΪ
a = 1; b = 2; c = 2; d = 1;
5¡¢¸´ºÏ¸³ÖµÔËËã·û
a += b Ï൱ÓÚ a = a + b;
a *= b + c Ï൱ÓÚ a = a * (b + c);
a = 2; a += a *= a; µÈ¼ÛÓÚ a += (a *= a); ×îºóa = 8£»
a = 5; b = 3;
int max = --a == b++ ? a++ : b++;
×îºómax = 4;
6¡¢Ç¿ÖÆÀàÐÍת»»
int a = 2;
int b = 5;
(float)b/aµÈÓÚ2.5
(float)(b/a)µÈÓÚ2.0
7¡¢×Ö·û´®¿½±´º¯Êý
char *strcpy(char *dest, const char *src);
º¯Êý¹¦ÄÜ£º½«×Ö·û´®src¸´ÖƵ½×Ö·ûÊý×édestÖУ¬·µ»Ø¸´ÖƵÄ×Ö·û´®¡£
src¿ÉÒÔÊÇ×Ö·ûÊý×éÃû¡¢³£Á¿»ò×Ö·ûÖ¸Õë±äÁ¿¡£
dest¿ÉÒÔÊÇ×Ö·ûÊý×éÃû»ò×Ö·ûÖ¸Õë±äÁ¿¡£ÈôdestÊÇ×Ö·ûÖ¸Õë±äÁ¿£¬Òª×¢Òâ¸ø¸ÃÖ¸Õë±äÁ¿¸³³õÖµ¡£
º¯Êý˵Ã÷£º
×Ö·ûÊý×é1³¤¶ÈÓ¦´óÓÚµÈÓÚ×Ö·û´®»ò×Ö·ûÊý×é2µÄ³¤¶È£»
×Ö·ûÊý×é1Ó¦¸Ãд³ÉÊý×éÃûµÄÐÎʽ
ÀýÈ磺
static char a[10] = "abcdefghi";
char b[] = "happy";
Ïà¹ØÎĵµ£º
»ªÇåÔ¶¼û 2010-01-22 09:21 ×÷ÕߣºÍõæ©æ©,»ªÇåÔ¶¼ûǶÈëʽѧԺ½²Ê¦¡£
ÔÚǶÈëʽ¿ª·¢ÖУ¬×÷Ϊµ×²ã¿ª·¢Õߣ¬¸ü¿´ÖصÄÊÇCÓïÑԵıà³ÌÄÜÁ¦£¬µ«×÷ΪӦÓóÌÐòµÄ¿ª·¢Õߣ¬ÎÒÏëѧϰC++»¹ÊÇÓбØÒªµÄ¡£ÄãÖ»ÓÐÔÚÁ˽âÁË£Ã++µÄÌØÐÔ£¬´Ó±¾ÖÊÉÏ¿´µ½ËüÓëCµÄÇø±ð²ÅÄܼᶨÄãÈÏʶѧϰËüµÄ¾öÐÄ¡£ÎÒ²»ÊÇ× ......
1¡¢Òþʽת»»
CÔÚÒÔÏÂËÄÖÖÇé¿öÏ»á½øÐÐÒþʽת»»:
1¡¢ËãÊõÔËËãʽÖУ¬µÍÀàÐÍÄܹ»×ª»»Îª¸ßÀàÐÍ¡£
2¡¢¸³Öµ±í´ïʽÖУ¬Óұ߱í´ïʽµÄÖµ×Ô¶¯Òþʽת»»Îª×ó±ß±äÁ¿µÄÀàÐÍ£¬²¢¸³Öµ¸øËû¡£
3¡¢º¯ ......
¹¤×÷ºóÎÒ×ÐϸÔĶÁÁ˹«Ë¾µÄ3DÒýÇæµÄÔ´´úÂ룬ÕâÊÇ¿îά»¤ÁËÊ®¼¸ÄêµÄÒýÇ棬Ö÷ÒªÔËÐÐÔÚXBox, PS3ºÍPCƽ̨ÉÏ¡£ºËÐIJ¿·ÖÓÃCÓïÑÔд£¬ÆäËû²¿·Ö×é¼þÓÃC++±àд¡£ÎÒÒÔÇ°ºÜÉÙÓÃCÓïÑÔ±à³Ì(°Ý´óѧ½ÌÓýËù´Í)£¬µ«¶ÁÁËÌ«¶àÕâ¿îÒýÇæµÄ´úÂëÉîÉîµÄÖÐÁËCÓïÑԵĶ¾¡£C¸øÎҵĸоõ¾ÍÊǼòµ¥Ã÷ÁË£¬Òª½â¾öÎÊÌâ¾ÍÊÇÖ±½ÓÈ¥½â¾öËü£¬¾ø²»¹ ......
Ô¤´¦Àí¹ý³ÌɨÃèÔ´´úÂ룬¶ÔÆä½øÐгõ²½µÄת»»£¬²úÉúеÄÔ´´úÂëÌṩ¸ø±àÒëÆ÷¡£¿É¼ûÔ¤´¦Àí¹ý³ÌÏÈÓÚ±àÒëÆ÷¶ÔÔ´´úÂë½øÐд¦Àí¡£
ÔÚCÓïÑÔÖУ¬²¢Ã»ÓÐÈκÎÄÚÔڵĻúÖÆÀ´Íê³ÉÈçÏÂһЩ¹¦ÄÜ£ºÔÚ±àÒëʱ°üº¬ÆäËûÔ´Îļþ¡¢¶¨Òåºê¡¢¸ù¾ÝÌõ¼þ¾ö¶¨±àÒëʱÊÇ·ñ°üº¬Ä³Ð©´úÂë¡£ÒªÍê³ÉÕâЩ¹¤×÷£¬¾ÍÐèҪʹÓÃÔ¤´¦Àí³ÌÐò¡£¾¡¹ÜÔÚÄ¿Ç°¾ø´ó¶àÊý±àÒëÆ÷¶¼°üº ......
//»ñÈ¡±¾»úIPµØÖ·º¯Êý
QString GetLocalIp()
{
int sock_get_ip;
char ipaddr[50];
struct sockaddr_in *sin;
struct ifreq ifr_ip;
if ((sock_get_ip=socket(AF_INET, SOCK_STREAM, 0)) == -1)
{
printf("socket create failse...GetLocalIp!\n");
return ""; ......