Ò׽ؽØÍ¼Èí¼þ¡¢µ¥Îļþ¡¢Ãâ°²×°¡¢´¿ÂÌÉ«¡¢½ö160KB

C unsigned int and int

Ê×ÏȽøÐÐÒ»¸öʵÑ飬·Ö±ð¶¨ÒåÒ»¸ösigned intÐÍÊý¾ÝºÍunsigned intÐÍÊý¾Ý£¬È»ºó½øÐдóС±È½Ï£º
unsigned int a=20;
signed int b=-130;
a>b?»¹ÊÇb>a£¿ÊµÑéÖ¤Ã÷b>a£¬Ò²¾ÍÊÇ˵£­130>20,Ϊʲô»á³öÏÖÕâÑùµÄ½á¹ûÄØ£¿
ÕâÊÇÒòΪÔÚCÓïÑÔ²Ù×÷ÖУ¬Èç¹ûÓöµ½ÎÞ·ûºÅÊýÓëÓзûºÅÊýÖ®¼äµÄ²Ù×÷£¬±àÒëÆ÷»á×Ô¶¯×ª»¯ÎªÎÞ·ûºÅÊýÀ´½øÐд¦Àí£¬Òò´Ëa£½20£¬b£½4294967166£¬ÕâÑù±È½ÏÏÂÈ¥µ±È»b>aÁË¡£
ÔÙ¾ÙÒ»¸öÀý×Ó£º
unsigned int a=20;
signed int b=-130;
std::cout<½á¹ûÊä³öΪ4294967186£¬Í¬ÑùµÄµÀÀí£¬ÔÚÔËËã֮ǰ£¬a£½20£¬b±»×ª»¯Îª4294967166£¬ËùÒÔa£«b£½4294967186

¼õ·¨ºÍ³Ë·¨µÄÔËËã½á¹ûÀàËÆ¡£

Èç¹û×÷Ϊsigned intÐÍÊý¾ÝµÄb=-130£¬bÓëÁ¢¼´ÊýÖ®¼ä²Ù×÷ʱ²»Ó°ÏìbµÄÀàÐÍ£¬ÔËËã½á¹ûÈÔȻΪsigned intÐÍ£º
signed int b=-130;
std::cout<Êä³öΪ-100¡£

¶ø¶ÔÓÚ¸¡µãÊýÀ´Ëµ£¬¸¡µãÊý£¨float£¬double£©Êµ¼ÊÉ϶¼ÊÇÓзûºÅÊý£¬unsigned ºÍsignedǰ׺²»ÄܼÓÔÚfloatºÍdoubleÖ®ÉÏ£¬µ±È»¾Í²»´æÔÚÓзûºÅÊý¸ùÎÞ·ûºÅÊýÖ®¼äת»¯µÄÎÊÌâÁË¡£


include
include

define UNSIGNED_SHORT_LT(a , b) (((unsigned short) (((unsigned short) a) - ((unsigned short) b))) > (unsigned short) 0x7fff)
define UNSIGNED_COMP_LT(a , b) ((unsigned int) (((unsigned int) a) - ((unsigned int) b)))

typedef struct test_node {
int num;
struct test_node *next;
} test_node_t;

test_node_t *head;
test_node_t *tail;

void build_link(int num)
{
if (head == NULL) {
test_node_t *tmp = (test_node_t *)malloc(sizeof(test_node_t));
tmp->num = num;
tmp->next = NULL;
head = tail = tmp;
} else {
test_node_t *tmp_add = (test_node_t *)malloc(sizeof(test_node_t));
tmp_add->num = num;
tmp_add->next = NULL;
tail->next = tmp_add;
tail = tmp_add;
}
}

void print_link()
{
test_node_t *p = head;
for (p = head; p; p = p->next)
printf("the %d node address:%x, head:%x, tail:%x\n", p->num, p, head, tail);
}

void clear_link()
{
test_node_t *p = head;

while (p) {
test_node_t *tmp = p;
p = p->next;
printf("free %d node, tmp:%x, p:%x, head:%x, tail:%x\n", tmp->num, tmp, p


Ïà¹ØÎĵµ£º

C³Ì100Àý

1/ÓÐ1¡¢2¡¢3¡¢4¸öÊý×Ö£¬ÄÜ×é³É¶àÉÙ¸ö»¥²»ÏàͬÇÒÎÞÖØ¸´Êý×ÖµÄÈýλÊý£¿¶¼ÊǶàÉÙ£¿
==============================================================
2/ÆóÒµ·¢·ÅµÄ½±½ð¸ù¾ÝÀûÈóÌá³É¡£ÀûÈó(I)µÍÓÚ»òµÈÓÚ10ÍòԪʱ£¬½±½ð¿ÉÌá10%£»ÀûÈó¸ß
¡¡¡¡¡¡ÓÚ10ÍòÔª£¬µÍÓÚ20ÍòԪʱ£¬µÍÓÚ10ÍòÔªµÄ²¿·Ö°´10%Ìá³É£¬¸ßÓÚ10ÍòÔªµÄ²¿·Ö£¬¿É¿ÉÌá ......

(ת£©Ñ§Ï°c/c++µÄ50¸öºÃÍøÕ¾

C/C++ÊÇ×îÖ÷ÒªµÄ±à³ÌÓïÑÔ¡£ÕâÀïÁгöÁË50ÃûÓÅÐãÍøÕ¾ºÍÍøÒ³Çåµ¥£¬ÕâÐ©ÍøÕ¾Ìṩc/c++Ô´´úÂë¡£Õâ·ÝÇåµ¥ÌṩÁËÔ´´úÂëµÄÁ´½ÓÒÔ¼°ËüÃǵÄС˵Ã÷¡£ÎÒÒѾ¡Á¦°üÀ¨×î¼ÑµÄC/C++Ô´´úÂëµÄÍøÕ¾¡£Õâ²»ÊÇÒ»¸öÍêÕûµÄÇåµ¥£¬ÄúÓн¨Òé¿ÉÒÔÁªÏµÎÒ£¬ÎÒ½«»¶Ó­ÄúµÄ½¨Ò飬ÒÔ½øÒ»²½¼ÓÇ¿Õâ·½ÃæµÄÇåµ¥¡£
1¡¢http://snippets.dzone.com/tag/c/ --ÊýÒÔǧ¼Æ ......

CÓëshell»ìºÏ±à³Ì


ÔÚlinuxÉÏд³ÌÐò¡¢×öÍø¹ÜµÄÈË£¬»ò¶à»òÉÙ¶¼»á¼¸Öֽű¾¡£½Å±¾ÓïÑÔÁé»îµÄ±äÁ¿ÀàÐÍ¡¢Ç¿´óµÄÕýÔò±í´ïʽ´¦ÀíÄÜÁ¦£¬ÔÙ¼ÓÉÏlinuxϵͳ±¾ÉíµÄ¹ÜµÀ¡¢Öض¨ÏòÒÔ¼°·á¸»µÄÃüÁîÐй¤¾ß£¬ÈÃÄã±à³ÌÆðÀ´ÓÎÈÐÓÐÓà¡£
¡¡¡¡¶øCÓïÑÔ¹ÌÈ»ÓÐÖÖÖÖÓÅÊÆ£¬µ«²»¿É·ñÈÏ£¬ºÜ¶à³¡ºÏÏ£¬Óýű¾ÓïÑÔ¸üΪ·½±ã£¬±ÈÈçÎÒÃǽ«¾ÙÀý˵Ã÷µÄ¶ÔÅäÖÃÎļþµÄ´¦Àí¡£
¡¡¡¡ÏÈ ......

PCÖ®¸¸C. ThackerÈÙ»ñ2009ÄêͼÁé½±


PCÖ®¸¸C. ThackerÈÙ»ñ2009ÄêͼÁé½±
2010-03-10 01:21 |  3110´ÎÔĶÁ |  ¡¾ÒÑÓÐ16ÌõÆÀÂÛ¡¿·¢±íÆÀÂÛ
¹Ø¼ü´Ê£ºÐÂÎÅ×ÊѶ  | ¸ÐлliujiangCEµÄÌṩ |  ÊÕ²ØÕâÆª×ÊѶ
¸ù¾ÝACM¹Ù·½ÍøÕ¾3ÔÂ9ÈÕ·¢²¼µÄÏûÏ¢£¬2009ÄêͼÁé½±ÊÚÓèÁËÏÖ´úPCÖ®¸¸Charles Thacker£¬ÒÔ±íÕÃËû¶ÔµÚһ̨ÏÖ´ú¸öÈ˼ÆËã»úXerox PARC Altoµ ......
© 2009 ej38.com All Rights Reserved. ¹ØÓÚE½¡ÍøÁªÏµÎÒÃÇ | Õ¾µãµØÍ¼ | ¸ÓICP±¸09004571ºÅ