¹ØÓÚC/C++º¯ÊýÉùÃ÷ÖвÎÊý¸öÊýµÄÒÉÎÊ
ÎÄÕÂ×÷ÕߣºSlyar
ÏÈ¿´Á½¸ö´úÂ룬µÚÒ»¸öÊÇC³ÌÐò£¬µÚ¶þ¸öÊÇC++³ÌÐò£¬³ýÁËÍ·Îļþ²»Í¬ÒÔÍâÆäËûµÄ¶¼Ò»Ñù¡£
//demo.c
#include <stdio.h>
int foo();
int main()
{
int a;
foo(a);
return 0;
}
int foo(int a)
{
}//demo.cpp
#include <iostream>
int foo();
int main()
{
int a;
foo(a);
return 0;
}
int foo(int a)
{
}
½á¹ûÊÇC³ÌÐò±àÒë³É¹¦£¬C++³ÌÐò±àÒëʧ°Ü£¬Ìáʾº¯ÊýÉùÃ÷ºÍº¯Êý¶¨Òå²ÎÊýÁÐ±í²»·û...ÕâºÜÕý³££¬¹Ø¼üÊÇC³ÌÐòÔõô¿ÉÄܱàÒëͨ¹ý...ÎÒÖªµÀC¿ÉÒÔд¿É±ä²ÎÊýÁÐ±í£¬ÎÊÌâÊÇÎÒû¼ÓÄǸö"..."°¡£¬囧£¬¿´À´ÊDZàÒëÆ÷µÄÎÊÌâÁË£¬ÒòΪ´úÂëÒ»Ñù...
²éÁËһЩ¹úÍâµÄ×ÊÁÏ£¬´óÖÂÁ˽âÁËÉÏÃæÄǸöÎÊÌâµÄ³ÉÒò£¬Í¬Ê±Ò²ÖªµÀÁËf()ºÍf(void)µÄÇø±ð£¬Ö®Ç°Ò»Ö±ÒÔΪËûÃÇÊÇÒ»ÑùµÄ...
In C, the declaration int f(void) means a function returning int that takes no parameters.
ÔÚCÓïÑÔÖУ¬f(void)±íÃ÷º¯Êý·µ»ØÕûÐͲ¢ÇÒûÓÐÈκβÎÊý¡£
The declaration int f() means a function returning int that takes any number of parameters.(takes an unknown number of parameters of unknown types, giving it the wrong number results in undefined behavior. )
¶øf()±íÃ÷º¯Êý·µ»ØÕûÐͲ¢ÇÒ¿ÉÒÔʹÓÃÈÎÒâ¸öÊýµÄ²ÎÊý£¬µ«ÊÇËûµÄÐÐΪÊDz»È·¶¨µÄ¡£
ÓÉ´Ë¿ÉÒÔ¿´³ö£¬ÔÚCÓïÑÔÖÐÊÇÍƼöʹÓÃf(void)ÕâÖÖÐÎʽµÄ£¬ÒòΪËüÃ÷È·Ö¸Ã÷Á˺¯ÊýûÓвÎÊý£¬f()ÓÉÓÚ¿ÉÒÔʹÓÃÈÎÒâ¸öÊýµÄ²ÎÊý£¬µ±È»Ò²°üÀ¨Ã»ÓвÎÊý¡£
¶øÔÚC++ÖУ¬ÎÒÏëÊDz»ÍƼöʹÓÃf(void)ÕâÖÖÐÎʽµÄ£¬ÒòΪf()ÒѾÃ÷È·±íÃ÷ûÓÐÈκβÎÊýÁË¡£
Ïà¹ØÎĵµ£º
ÒÔTMS320VC5402ΪÀý£¬Ì½ÌÖÒ»ÖÖ×ÛºÏÔËÓÃCÓïÑÔ¡¢Êý¾ÝÎļþ¼°GELÓïÑÔµÄFlash±à³Ìз½·¨¡£
¡¡¡¡¸Ã·½·¨ÍêÈ«²ÉÓÃCÓïÑÔ±àдÉÕд³ÌÐò£¬½â¾öÁËÖ¸Õë²»ÄÜ·ÃÎʸ߶ËFlashµÄÎÊÌâ;°ÑÒýµ¼±í×÷³ÉÊý¾ÝÎļþ£¬¿ÉʵÏÖ´óÒýµ¼±íµÄ·ÖÅú´Î¼ÓÔØ;ͨ¹ýGEL³ÌÐò¿ØÖÆC³ÌÐòÖ´ÐУ¬½ÏºÃµØÌåÏÖÁËFlash±à³ÌµÄÁ÷³Ì¡£
¡¡¡¡ÒýÑÔ
¡¡¡¡ÔÚDSPÓ¦ÓÃϵͳ¿ª·¢µÄºóÆÚ£¬Ò»° ......
C/C++ÊÇ×îÖ÷ÒªµÄ±à³ÌÓïÑÔ¡£ÕâÀïÁгöÁË50ÃûÓÅÐãÍøÕ¾ºÍÍøÒ³Çåµ¥£¬ÕâЩÍøÕ¾Ìṩc/c++Ô´´úÂë¡£Õâ·ÝÇåµ¥ÌṩÁËÔ´´úÂëµÄÁ´½ÓÒÔ¼°ËüÃǵÄС˵Ã÷¡£ÎÒÒѾ¡Á¦°üÀ¨×î¼ÑµÄC/C++Ô´´úÂëµÄÍøÕ¾¡£Õâ²»ÊÇÒ»¸öÍêÕûµÄÇåµ¥£¬ÄúÓн¨Òé¿ÉÒÔÁªÏµÎÒ£¬ÎÒ½«»¶ÓÄúµÄ½¨Ò飬ÒÔ½øÒ»²½¼ÓÇ¿Õâ·½ÃæµÄÇåµ¥¡£
1¡¢http://snippets.dzone.com/tag/c/ --ÊýÒÔǧ¼Æ ......
1.ÄÚ´æ·ÖÅ䷽ʽ
¡¡¡¡ÄÚ´æ·ÖÅ䷽ʽÓÐÈýÖÖ£º
¡¡¡¡[1]´Ó¾²Ì¬´æ´¢ÇøÓò·ÖÅä¡£ÄÚ´æÔÚ³ÌÐò±àÒëµÄʱºò¾ÍÒѾ·ÖÅäºÃ£¬Õâ¿éÄÚ´æÔÚ³ÌÐòµÄÕû¸öÔËÐÐÆڼ䶼´æÔÚ¡£ÀýÈçÈ«¾Ö±äÁ¿£¬static±äÁ¿¡£
¡¡¡¡[2]ÔÚÕ»ÉÏ´´½¨¡£ÔÚÖ´Ðк¯Êýʱ£¬º¯ÊýÄÚ¾Ö²¿±äÁ¿µÄ´æ´¢µ¥Ôª¶¼¿ÉÒÔÔÚÕ»ÉÏ´´½¨£¬º¯ÊýÖ´ÐнáÊøʱÕâЩ´æ´¢µ¥Ôª×Ô¶¯±»ÊÍ·Å¡£Õ»ÄÚ´æ·ÖÅäÔËËãÄÚÖÃÓÚ ......
#include<stdio.h>
int cubeByValue(int n);
int main(){
int number = 5 ;
printf("The original value of number is %d\n",number);
number = cubeByValue(number);
printf("The new  ......
CÖеĿɱä²ÎÊýÑо¿
Ò»£® ºÎν¿É±ä²ÎÊý
int
printf( const char* format, ...);
ÕâÊÇʹÓùýCÓïÑÔµÄÈËËùÔÙÊìϤ²»¹ýµÄprintfº¯ÊýÔÐÍ£¬ËüµÄ²ÎÊýÖÐ
¾ÍÓй̶¨²ÎÊýformatºÍ¿É±ä²ÎÊý£¨ÓÔ…”±íʾ£©. ¶øÎÒÃÇÓÖ¿ÉÒÔÓø÷ÖÖ·½Ê½À´µ÷ÓÃprintf,Èç:
printf("%d",value);
printf("%s",s ......