C ѧϰ±Ê¼Ç£º ÒÆÎ»²Ù×÷Á·Ï°¡£
#include <stdio.h>
unsigned int reverse_bits(unsigned int value)
{
unsigned int answer;
unsigned int i;
answer = 0;
for(i=1;i!=0;i<<=1){ //´ËÑ»·¿ÉÒÔºöÂÔ»úÆ÷µÄ²îÒì¡£64λºÍ32λ½Ô¿ÉÓã¬ÔöÇ¿´Ë´úÂëµÄ¿ÉÒÆÖ²ÐÔ
answer <<=1;
if(value & 1)
answer |= 1;
value >>=1;
}
return answer;
}
int main(void)
{
unsigned int get_answer=reverse_bits(13);
int i=31;
char t;
while(i)
{
t ='0'+ ((get_answer >> i) & 1);
printf("%c",t);
i--;
}
}
<<CºÍÖ¸Õë>> µÚ5ÕÂÁ·Ï°Ìâ¡£
Linux 2.6 kernelÖеÄset_bit²Ù×÷£º
ÐèÒª¿¼ÂÇ»úÆ÷ÊÇ32λ»¹ÊÇ64λµÄ¼ÆËã»ú¡£
static inline void set_bit(int nr, volatile unsigned long *addr)
{
int *a = (int *)addr;
int mask;
//unsigned long flags;
a += nr >> 5;
mask = 1 << (nr & 0x1f);
//local_irq_save_hw(flags);
*a |= mask;
//local_irq_restore_hw(flags);
}
Ïà¹ØÎĵµ£º
£¨×¢£¬±¾ÎÄÊÇ·ÒëµÄhttp://www.cprogramming.com/
ÉϵÄÎÄÕ Where C and C++ Differ
£©
C++»ùÓÚC£¬Ò²±£ÁôÁËCµÄ´ó²¿·ÖÌØÐÔ¡£µ«ÊÇÔÚÔ´Âë¼¶ÉÏÓÐЩµØ·½ÊÇÓëC²»¼æÈݵġ£
C³ÌÐòԱʹÓÃC++ʱµÄÏÝÚå
´Ó void* µÄÒþʽ·ÖÅä
²»ÄÜ´Ó void* ÒþʽµØ·ÖÅäµ½ÆäËûÈκÎÀàÐÍ¡£ÀýÈ磬ÏÂÃæµÄ´úÂëÔÚCÖÐÊǷdz£ÓÐЧµÄ¡£
in ......
B/S½á¹¹£¬¼´Browser/Server£¨ä¯ÀÀÆ÷/·þÎñÆ÷£©½á¹¹£¬ÊÇËæ×ÅInternet¼¼ÊõµÄÐËÆð£¬¶ÔC/S½á¹¹µÄÒ»Öֱ仯»òÕ߸ĽøµÄ½á¹¹¡£ÔÚÕâÖÖ
½á¹¹Ï£¬Óû§½çÃæÍêȫͨ¹ýWWWä¯ÀÀÆ÷ʵÏÖ£¬Ò»²¿·ÖÊÂÎñÂß¼ÔÚǰ¶ËʵÏÖ£¬µ«ÊÇÖ÷ÒªÊÂÎñÂß¼ÔÚ·þÎñÆ÷¶ËʵÏÖ£¬ÐγÉËùν3-tier½á¹¹¡£B/S½á¹¹£¬Ö÷ÒªÊÇ
ÀûÓÃÁ˲»¶Ï³ÉÊìµÄWWWä¯ÀÀÆ÷¼¼Êõ£¬½áºÏä¯ÀÀÆ÷µÄ¶àÖ ......
http://demonstyle.blog.163.com/blog/static/13143429020091010112159/
C/C++ ºêÏê½â
ic/c++ 2009-11-10 01:12:15 ÔĶÁ18 ÆÀÂÛ0 ×ֺţº´óÖÐС
ÖÚ¶àC++Êé¼®¶¼ÖÒ¸æÎÒÃÇCÓïÑÔºêÊÇÍò¶ñÖ®Ê×£¬µ«ÊÂÇé×ܲ»ÈçÎÒÃÇÏëÏóµÄÄÇô»µ£¬¾ÍÈçͬgotoÒ»Ñù¡£ºêÓÐ
Ò»¸öºÜ´óµÄ×÷Ó㬾ÍÊÇ×Ô¶¯ÎªÎÒÃDzúÉú´úÂë¡£Èç¹û˵ģ°å¿ÉÒÔΪÎÒÃDzúÉú¸÷ÖÖÐÍ ......
ÓÃvc6н¨ÁËÒ»¸öwin32µÄ¿ØÖÆÌ¨³ÌÐò£¬µ÷ÊÔÒ»¸öÖ±½Ó²åÈëÅÅÐòµÄС³ÌÐò£¬Îļþ¶¨ÒåΪ.cÎļþ£¬¶ø²»ÊÇÒ»°ãʹÓõÄ.cppÎļþ£¬´úÂë¶ÎÈçÏ£º
#include <stdio.h>
void inst(int* x,int n)
{
int i,j,t;
for(i=1; i<n; i++) /* i±íʾ²åÈë´ÎÊý£¬¹²½øÐÐn-1´Î²åÈë*/
{
t = x[i];
for(j=i-1; j> ......
ubuntuϵÄc/c++»·¾³´î½¨ÊDZȽϼòµ¥,ÒòΪÓÐaptºÍÐÂÁ¢µÃµÄ°ïÖú.
1.
Ê×ÏÈÊÇÅäÖÃgcc,ÔÚubuntu°²×°Íê³ÉÒѾÓÐgccÁË(gccÊÇÓÉGNUÖ®¸¸StallmanËù¿ª·¢µÄlinuxϵıàÒëÆ÷£¬È«³ÆÎªGNU
Compiler Collection£¬ Ŀǰ¿ÉÒÔ±àÒëµÄÓïÑÔ°üÀ¨£ºC, C++, Objective-C, Fortran, Java,
and
Ada.).µ«ÊÇgcc»¹²»ÄܱàÒëÎļþ.ÒòΪȱÉÙһЩͷÎļþ.Ä ......