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

C³ÌÐòʹÓò»Í¬º¯Êýµ÷ÓÃÔ¼¶¨µ÷Óûã±à×Ó¹ý³Ì

ÈçתÔØ£¬Çë×¢Ã÷³ö´¦£ºhttp://blog.csdn.net/zhangyang0402/archive/2010/05/01/5549266.aspx
 
¿ª·¢¹¤¾ß£ºVC ++ 6.0  MASM32
 
Ò»¡¢__cdeclµ÷Ó÷½Ê½
 
1£®  ÔÚVCÖÐн¨Win32 Console Application, TestASM
 
2£®  н¨test.c
#include<stdio.h>
extern void swap(int *px, int *py);
int main(void)
{
       int a=1, b=2;
       printf("before swaping, a=%d, b=%d\n", a, b);
       swap(&a, &b);
       printf("after  swaping, a=%d, b=%d\n", a, b);
    return 0;
}
 
3£®  ʹÓÃUltraEdit±à¼­»ã±à³ÌÐòswap.asm
.386
.MODEL FLAT, C
OPTION CASEMAP:NONE
.CODE
  swap PROC a:DWORD, b:DWORD
    PUSH ESI
    PUSH EDI
      MOV ESI, [EBP+8]
     MOV EAX, [ESI]    ;²ÎÊý1µÄÖµ->EAX
      MOV EDI, [EBP+12]
      XCHG EAX, [EDI]
      MOV [ESI], EAX
      POP EDI
      POP ESI
      RET
  swap ENDP
END
 
4£®  ½«swap.asmÌí¼Óµ½TestASM¹¤³ÌÖÐ
VC->Project->Add to project->Files, ÎļþÀàÐÍÑ¡Ôñ“ËùÓÐÎļþ”£¬Ñ¡Öлã±àÔ´Îļþswap.asm²¢Ìí¼Óµ½¹¤³Ì
»òÖ±½Ó±àÒëswap.asm£¬½«Éú³ÉµÄswap.obj¿½±´µ½¹¤³ÌĿ¼ÏÂ
5£®  ÔÚVCÖÐÉèÖûã±à³ÌÐò±àÒëÑ¡Ïî
ÔÚVCµÄFileViewÖУ¬ÓÒ»÷swap.asm->Settings, Çл»µ½“Custom Build”Ñ¡Ï£¬
ÔÚ“Command”ÖÐÊäÈ룺ml /c /coff  $(InputName).asm£¬
“Output”ÖÐÊäÈë £º$(InputName).obj
 
6£®  ±àÒëÁ´½ÓÖ´ÐÐ
Ë«»÷test.c->Compile£¬ Éú³Étest.obj
Ë«»÷swap.asm->Compile£¬ Éú³Éswap.obj
È»ºóBuild£¬ Éú³ÉTestASM.exe
×îºóÖ´ÐÐ
½á¹ûÈçÏÂ:
before swaping, a=1, b=2
after  swaping, a=2, b=1
Press any key to continue
 
¶þ¡¢__stdcallµ÷Ó÷½Ê½
1.CÔ´³ÌÐò
#include<stdio.h>
extern


Ïà¹ØÎĵµ£º

extern cµÄ×÷ÓÃ

extern cµÄ×÷Óá¾×ª¡¿
2009-12-18 13:10
1.ÒýÑÔ
C++ÓïÑԵĴ´½¨³õÖÔÊÇ“a better C”£¬µ«ÊÇÕâ²¢²»Òâζ×ÅC++ÖÐÀàËÆCÓïÑÔµÄÈ«¾Ö±äÁ¿ºÍº¯ÊýËù²ÉÓõıàÒëºÍÁ¬½Ó·½Ê½ÓëCÓïÑÔÍêÈ«Ïàͬ¡£×÷ΪһÖÖÓûÓëC¼æÈݵÄÓïÑÔ£¬C++±£ÁôÁËÒ»²¿·Ö¹ý³Ì ʽÓïÑÔµÄÌص㣨±»ÊÀÈ˳ÆΪ“²»³¹µ×µØÃæÏò¶ÔÏ󔣩£¬Òò¶øËü¿ÉÒÔ¶¨Òå²»ÊôÓ ......

C/C++Êý×éÃûÓëÖ¸ÕëÇø±ðÉîÈë̽Ë÷

Ö¸ÕëÊÇC/C++ÓïÑÔµÄÌØÉ«£¬¶øÊý×éÃûÓëÖ¸ÕëÓÐÌ«¶àµÄÏàËÆ£¬ÉõÖÁºÜ¶àʱºò£¬Êý×éÃû¿ÉÒÔ×÷ΪָÕëʹÓá£ÓÚÊǺõ£¬ºÜ¶à³ÌÐòÉè¼ÆÕ߾ͱ»¸ãºýÍ¿ÁË¡£¶øÐí¶àµÄ´óѧÀÏʦ£¬ËûÃÇÔÚCÓïÑԵĽÌѧ¹ý³ÌÖÐÒ²´íÎóµÃ¸øѧÉú½²½â£º"Êý×éÃû¾ÍÊÇÖ¸Õë"¡£ºÜÐÒÔË£¬ÎҵĴóѧÀÏʦ¾ÍÊÇÆäÖÐÖ®Ò»¡£Ê±ÖÁ½ñÈÕ£¬ÎÒÈÕ¸´Ò»ÈյؽøÐÐ×ÅC/C++ÏîÄ¿µÄ¿ª·¢£¬¶øÉí±ß»¹Ò»Ö±³äÂúÕ ......

CÖжÁÈ¡Êý×é

#include <stdio.h>
#include <stdlib.h>
#define MAXSIZE 100
main()
{
FILE *fp;
if ( (fp = fopen( "c:\\a.txt", "r" )) == NULL ) printf("ERROR!\n");
int tmp[MAXSIZE];
int i;
for ( i=0; i<MAXSIZE; i++ )
{
tmp[i] = 0; ......

C/C++ÖÐtypedefµÄÓ÷¨£¬¸æËßÄã²»Ò»ÑùµÄtypedef


<!--
/* Font Definitions */
@font-face
{font-family:ËÎÌå;
panose-1:2 1 6 0 3 1 1 1 1 1;
mso-font-alt:SimSun;
mso-font-charset:134;
mso-generic-font-family:auto;
mso-font-pitch:variable;
mso-font-signature:3 135135232 16 0 262145 0;}
@font-face
{font-family:"\@ËÎÌå" ......

Ö°¹¤¹¤×ʹÜÀíϵͳ£¨ÎҵĵÚÒ»¸öC³ÌÐò£©


#include<stdio.h>
#include<stdlib.h>
#include<conio.h>
#include<string.h>
#include<windows.h>
#include<malloc.h>
#include<math.h>
typedef struct worker

 int num; //±àºÅ
 char name[15]; //ÐÕÃû
 char zhicheng[15];& ......
© 2009 ej38.com All Rights Reserved. ¹ØÓÚE½¡ÍøÁªÏµÎÒÃÇ | Õ¾µãµØͼ | ¸ÓICP±¸09004571ºÅ