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

¹ØÓÚC/C++ÖÐÖ¸Õë×öÐβεÄÒ»µãС·ÖÎö(ת)

 
2009-07-26 15:50
½ñÌìÇÞÊÒµÄɽ¶«ÐÖµÜÔÚÁ·¶þ¼¶µÄÉÏ»ú£¬ÆäÖÐÒ»¸öÌâÄ¿´ó¸ÅÊÇÕâÑù£ºÔÚÒ»¸öº¯ÊýÖУ¬ÓÐÒ»¸öÖ¸ÕëÐβΣ¬¼ÇΪ*p£¬È»ºóÔÚº¯ÊýÄÚ²¿¶¨ÒåÁËÁÙʱ±äÁ¿a,aºÍ*pÊÇͬÖÖÀàÐÍ¡£¾­¹ýһϵÁмÆËã £¬aµÃµ½ÁËÒ»¸öÖµ£¬Õâ¸öÖµ×îºóÊÇÐèÒª¼Ç¼ÔÚÖ¸Õë*pÀïÃæµÄ£¬Ó¦¸ÃÔõô±£´æÄØ£¿ÎÒµ±Ê±Ëæ±ã¾Í˵£¬p=&a¡£½á¹û·¢Éú´íÎóÁË£¬Ã»Óеõ½Ô¤ÆÚ½á¹û¡£ÕýÈ·´ð°¸ÊÇ*p=a¡£
ÏÂÃæÀ´·ÖÎöÏÂÔ­Òò¡£
ѧ¹ýCµÄÈ˶¼ÖªµÀµ½£¬º¯ÊýµÄʵ²ÎÓëÐβεÄÖ®¼äÊÇÖµ´«µÝ£¬µ¥Ïò´«µÝ¡£ÔÚÌ·ºÆÇ¿ÄDZ¾CÓïÑԽ̲ÄÖоÍÓÐÕâÑùÒ»¸ö¾­µäµÄÀý×Ó£º
int a=3,b=4;
void exchange(int x,int y)
...{  
          int temp;
           temp=a;a=b;b=temp;   //ÊÔͼ½»»»a,b
}
exchange(a,b);
cout<<a<<" "<<b<<endl;
Êä³öµÄÀ´µÄÈÔÈ»ÊÇ3£¬4.
Òª½»»»a,b,Ö»Ðè¸Ä±äº¯Êýexchange£¬´«µÝa,bµÄµØÖ·£¬ÈçÏ£º
void exchange(int *x,int *y)
{
         int temp;
          temp=*x;*x=*y;*y=temp;
}
   exchange(&a,&b);
   cout<<a<<" "<<b<<endl;
  
ÕâÑù£¬a,b¾Í³É¹¦½»»»ÁË¡£ÎªÊ²Ã´ÄØ£¿ÏÂÃæÔÙ˵¡£
Ôٻص½¿ªÊ¼Ìá³öµÄÄǸöÎÊÌ⣬Ϊʲôp=&a´íÎó¶ø*p=aÕýÈ·ÄØ£¿
ÔÙ¿´Á½¶Î´úÂ룺
#include<iostream>
using namespace std;
void test_point(int *p)
...{
     int a=3;
      p=&a;   // ²»Í¬Ö®´¦
}
int main()
...{
     int x=4;
     int *p1=&x;
      test_point(p1);
      cout<<*p1<<endl;
         return 0;
}
   
   
´ËʱÊä³öµÄ½á¹ûÊÇ4£¬Ò²¾ÍÊÇ˵£¬Ö¸Õëp1µ÷ÓÃtest_pointº¯ÊýºóÖµ²¢Ã»Óеõ½¸Ä±ä£¬½Ó×Å¿´ÏÂÒ»¶Î´úÂë
#include<iostream>
using namespace std;
void test_point(int *p)
...{
     int a=3;
   &nb


Ïà¹ØÎĵµ£º

Àí½â¸´ÔÓµÄC/C++ÉùÃ÷ const, typedef , º¯ÊýÖ¸Õë

 ÈÃÎÒÃÇ´ÓÒ»¸ö·Ç³£¼òµ¥µÄÀý×Ó¿ªÊ¼£¬ÈçÏ£º
int n;
Õâ¸öÓ¦¸Ã±»Àí½âΪ“declare n as an int”£¨nÊÇÒ»¸öintÐ͵ıäÁ¿£©¡£
½ÓÏÂÈ¥À´¿´Ò»ÏÂÖ¸Õë±äÁ¿£¬ÈçÏ£º
int *p;
Õâ
¸öÓ¦¸Ã±»Àí½âΪ“declare p as an int *”£¨pÊÇÒ»¸öint
*Ð͵ıäÁ¿£©£¬»òÕß˵pÊÇÒ»¸öÖ¸ÏòÒ»¸öintÐͱäÁ¿µÄÖ¸Õë¡£ÎÒÏëÔÚÕ ......

c ÓïÑÔ³£Óú궨Òå Ä£°å

 
³£Óú궨Òå
1¡¢·ÀÖ¹Ò»¸öÍ·Îļþ±»Öظ´°üº¬
#ifndef COMDEF_H
#define COMDEF_H
//Í·ÎļþÄÚÈÝ
#endif
2¡¢ÖØж¨ÒåһЩÀàÐÍ£¬·ÀÖ¹ÓÉÓÚ¸÷ÖÖƽ̨ºÍ±àÒëÆ÷µÄ²»Í¬£¬¶ø²úÉúµÄÀàÐÍ×Ö½ÚÊý²îÒ죬·½±ãÒÆÖ²¡£
typedef  unsigned char      boolean;     /* Boolean v ......

¡¾×ª¡¿cÅжϴó¶ËС¶Ëģʽ

ÊÔÌâ1£ºÇëдһ¸öCº¯Êý£¬Èô´¦ÀíÆ÷ÊÇBig_endianµÄ£¬Ôò·µ»Ø0£»ÈôÊÇLittle_endianµÄ£¬Ôò·µ»Ø1
½â´ð£º
int checkCPU( )
{
    {
           union w
           {  
  &n ......

C/SÓëB/S¼Ü¹¹

C/S½á¹¹£¬¼´Client/Server(¿Í»§»ú/·þÎñÆ÷)½á¹¹£¬ÊÇ´ó¼ÒÊìÖªµÄÈí¼þϵͳÌåϵ½á¹¹£¬Í¨¹ý½«ÈÎÎñºÏÀí·ÖÅäµ½Client¶ËºÍServer¶Ë£¬½µµÍÁËϵͳµÄͨѶ¿ªÏú£¬¿ÉÒÔ³ä·ÖÀûÓÃÁ½¶ËÓ²¼þ»·¾³µÄÓÅÊÆ¡£ÔçÆÚµÄÈí¼þϵͳ¶àÒÔ´Ë×÷ΪÊ×Ñ¡Éè¼Æ±ê×¼¡£
B/S½á¹¹£¬¼´Browser/Server(ä¯ÀÀÆ÷/·þÎñÆ÷)½á¹¹£¬ÊÇËæ×ÅInternet¼¼ÊõµÄÐËÆ𣬶ÔC/S½á¹¹µÄÒ»Öֱ仯 ......

²»¿ÉС¿´µÄextern "C"

     ÏîÄ¿ÖÐÒªÓõ½Ò»¸öÄ£¿é¡£¿´ÁËϸÃÄ£¿éµÄÓ÷¨£¬¾ÍÒÀºù«»­Æ°µÄ°áµ½×Ô¼ºµÄ´úÂëÀïÃæÀ´ÁË¡£²»¹ýÔÚ±àÒëµÄʱºòÅöµ½ÁËÂé·³£¬ ÔÚ³ÌÐòÁ´½ÓµÄʱºò³ö´í£º“undefined reference to***",Ó¦¸ÃÊÇÒòΪûÓаüº¬ÏàÓ¦µÄ¿âÎļþ°É¡£
      ÓÚÊDZȽÏÁËmake fileÎļþµÄд·¨£¬ÊÔͼÔÚÎÒÕâ±ß ......
© 2009 ej38.com All Rights Reserved. ¹ØÓÚE½¡ÍøÁªÏµÎÒÃÇ | Õ¾µãµØͼ | ¸ÓICP±¸09004571ºÅ