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

C/C++ÓïÑÔÖÐÖ¸ÕëµÄÒâÒå

¿´µ½Õâ¸öÃæÊÔÌâ,¹À¼ÆºÜ¶à¸ÕѧCÖ¸ÕëµÄͬѧ¶¼»á¸ã´í.
void GetMemory(char *p)
{
// ´«µÝ½øÀ´µÄµÄֵʹµÃ*p==NULL
// ÕâÀïÐ޸ĵÄÊÇÕâ¸öº¯ÊýÄÚµÄÁÙʱָÕë±äÁ¿pµÄÖµ
p = (char *)malloc(100);
}
void Test(void)
{
char *str = NULL;
// ´«µÝ½øÈ¥µÄÊÇstrµÄÖµNULL
GetMemory(str);
// ÕâÀïstrÖ¸Õ벢δ¸³Öµ,ÈÔÈ»ÊÇNULL,ËùÒÔÕâÀ︳ֵ»á³ö´í
strcpy(str, "Hello World");
printf("%s\n", str);
free(str);
}

ÎÒÃÇÖªµÀ¼ÆËã»úÖ»ÈÏʶ0ºÍ1,ËùÓеÄÊý¾Ý,°üÀ¨Í¼Æ¬,ÎÄ×ÖµÈ×îÖÕ¶¼ÊÇת»»³É0ºÍ1À´±íʾ.
ΪÁË·½±ã˵Ã÷,ÎÒÃÇÓÃÊ®Áù¸ö¶þ½øÖÆÊý×é³ÉµÄÒ»¸öÊ®Áù½øÖÆÊýÀ´±íʾ.
ÔÚwin32ϵͳÖÐ,ÄÚ´æµØÖ·ÊÇ´Ó0µ½2^32bit(Ï൱ÓÚ0µ½4GB),win32ÖÐVC6.0ÖÐÖ¸Õë±¾ÖʾÍÊÇÒ»¸öÕ¼4¸ö×Ö½ÚµÄÎÞ·ûºÅÕûÐÎ(unsigned int),ÄÜÈ¡0µ½2^32ÖÐËùÓеÄÖµµÄÈÎÒ»¸öÖµ,¼´Ö¸ÕëÄÜÏò¼ÆËã»úÄÚ´æÖÐÈκÎÒ»¸öµØÖ·.
// pCharÖ¸ÏòµÄÒ»¸öcharÐͱäÁ¿(×¢Òâ×Ö·ûºÍ×Ö·û´®¸ÅÄîÇø·Ö¿ª)
char *pChar = NULL;
// pIntÖ¸ÏòµÄÊÇÒ»¸öintÐͱäÁ¿
int *pInt = NULL;
// pDoubleÖ¸ÏòµÄÊÇÒ»¸öpDoubleÐͱäÁ¿
double *pDouble = NULL;
struct node
{
int i, j, k;
};
// pNodeÖ¸ÏòµÄÊÇÒ»¸ö×Ô¶¨Òå½á¹¹Ìå±äÁ¿
struct node *pNode = NULL;
class TestClass
{
TestClass()
{
}
~TestClass()
{
}
};
// pClassÖ¸ÏòµÄÊÇÒ»¸ö×Ô¶¨ÒåÀà±äÁ¿
TestClass *pClass = NULL;
void Test(void)
{
printf("This is test function!\n");
}
typedef void (*pFunction)(void);
// pFunÖ¸ÏòµÄÊÇÒ»¸öTestÐͺ¯Êý
pFunction pFun = Test;
void Test1(void)
{
printf("sizeof(pChar)=%d\n", sizeof(pChar));
printf("sizeof(pInt)=%d\n", sizeof(pInt));
printf("sizeof(pDouble)=%d\n", sizeof(pDouble));
printf("sizeof(pNode)=%d\n", sizeof(pNode));
printf("sizeof(pClass)=%d\n", sizeof(pClass));
printf("sizeof(pFun)=%d\n", sizeof(pFun));
}
´òÓ¡µÄ½á¹ûÈçÏÂ:
sizeof(pChar)=4
sizeof(pInt)=4
sizeof(pDouble)=4
sizeof(pNode)=4
sizeof(pClass)=4
sizeof(pFun)=4
Press any key to continue
ÉÏÃ涨ÒåµÄÖ¸ÕëºÍÆäËüϵͳÄܶ¨ÒåµÄËùÓÐÖ¸ÕëÔÚwin32ϵͳÖÐÓÃsizeof²âÊÔ¶¼ÊÇ4.
Ö¸ÕëÓÐʲôÇø±ðÄØ?
±ÈÈçchar *pCharºÍint *pInt:
pCharÖ»ÊǸæËß³ÌÐòÎ


Ïà¹ØÎĵµ£º

CÓïÑÔλÔËËã

Ç°Ãæ½éÉܵĸ÷ÖÖÔËË㶼ÊÇÒÔ×Ö½Ú×÷Ϊ×î»ù±¾Î»½øÐеġ£ µ«Ôںܶàϵͳ³ÌÐòÖг£ÒªÇóÔÚλ(bit)Ò»¼¶½øÐÐÔËËã»ò´¦Àí¡££ÃÓïÑÔÌṩÁËλÔËËãµÄ¹¦ÄÜ£¬ÕâʹµÃ£ÃÓïÑÔÒ²ÄÜÏñ»ã±àÓïÑÔÒ»ÑùÓÃÀ´±àдϵͳ³ÌÐò¡£
12.1 λÔËËã·û£ÃÓïÑÔÌṩÁËÁùÖÖλÔËËã·û£º
    &          °´ ......

ÓÃCÓïÑÔÀ©Õ¹PythonµÄ¹¦ÄÜ


Ô­ÎÄ
PythonºÍC·Ö±ðÓÐן÷×ÔµÄÓÅȱµã£¬ÓÃPython¿ª·¢³ÌÐòËٶȿ죬¿É¿¿ÐԸߣ¬²¢ÇÒÓÐÐí¶àÏÖ³ÉÄ£¿é¿É¹©Ê¹Ó㬵«Ö´ÐÐËÙ¶ÈÏà¶Ô½ÏÂý£»CÓïÑÔÔòÕýºÃÏà·´£¬ÆäÖ´ÐÐËٶȿ죬µ«¿ª·¢Ð§Âʵ͡£ÎªÁ˳ä·ÖÀûÓÃÁ½ÖÖÓïÑÔ¸÷×ÔµÄÓŵ㣬±È½ÏºÃµÄ×ö·¨ÊÇÓÃPython¿ª·¢Õû¸öÈí¼þ¿ò¼Ü£¬¶øÓÃCÓïÑÔʵÏÖÆä¹Ø¼üÄ£¿é¡£±¾ÎĽéÉÜÈçºÎÀûÓÃCÓïÑÔÀ´À©Õ¹PythonµÄ¹¦ ......

Linux»·¾³ÏÂÓÃcÓïÑÔдµÄ²¥·ÅwavÎļþµÄС³ÌÐò

http://blog.csdn.net/noah1987/archive/2008/10/21/3118934.aspx
±¾³ÌÐò¿ÉÒÔ¶ÁÈ¡.wavÎļþ£¬È»ºó½øÐв¥·Å¡£
ʹÓÃÇ°£¬ÇëÈ·ÈÏÄúÊÇ·ñ°²×°ÒôƵÇý¶¯¡£
È·ÈÏ·½·¨£ºcat /etc/sndstat£¬Èç¹ûÏÔʾÎÞ´ËÉ豸£¬ÔòûÓа²×°Çý¶¯¡£
°²×°Çý¶¯ºÜ¼òµ¥£¬µ½oss.comÉÏÏÂÔØÒôƵÇý¶¯£¬È»ºó°´ÕÕÍøÉϵĽ̳̽øÐоͿÉÒÔÁË¡£
Ô´´úÂëÈçÏ£º
#include ......

C/C++ÖеÄÈÕÆÚºÍʱ¼ä

תÔØÓÚÕâÀhttp://www.programfan.com/article/showarticle.asp?id=2798
²»Ì«¶®ÈçºÎ¶ÔÔËÓÃc++µÄʱ¼äº¯ÊýµÄÅóÓѶ࿴¿´°É¡£
*************************ÆÓËصķָîÏß**********************************
׫ÎÄ/ÖÜÏè
ͻ񻣼
±¾ÎÄ´Ó½éÉÜ»ù´¡¸ÅÄîÈëÊÖ£¬Ì½ÌÖÁËÔÚC/C++ÖжÔÈÕÆÚºÍʱ¼ä²Ù×÷ËùÓõ½µÄÊý¾Ý½á¹¹ºÍº¯Êý£¬²¢¶Ô¼Æʱ¡¢Ê ......

¡¶The C Programming Language¡·µÚ¶þ´ÎÔĶÁÖ®ÊÕ»ñ

µÚÒ»Õ µ¼ÑÔ
    1£¬¶¨Òå(define)ÓëÉùÃ÷(declaration) 
    ¶¨Òå±íʾ´´½¨±äÁ¿»ò·ÖÅä´æ´¢µ¥Ôª£»¶øÉùÃ÷Ö¸µÄÊÇ˵Ã÷±äÁ¿µÄÐÔÖÊ£¬µ«²»·ÖÅä´æ´¢µ¥Ôª¡£
µÚ¶þÕ ÀàÐÍ¡¢ÔËËã·ûºÍ±í´ïʽ
    1£¬Êý¾ÝÀàÐͼ°³¤¶È
    CÖÐÖ»ÓÐ4ÖÖ»ù±¾Êý¾ÝÀàÐÍ£ºchar ,int ,float ......
© 2009 ej38.com All Rights Reserved. ¹ØÓÚE½¡ÍøÁªÏµÎÒÃÇ | Õ¾µãµØͼ | ¸ÓICP±¸09004571ºÅ