ANSI C——¿É±ä²ÎÊý
¡¾ÔÐÍ¡¿
type fun( type arg1, type arg2, ...
);
¡¾ÃèÊö¡¿
Ö÷ÒªÓÃÔÚ²ÎÊý¸öÊý²»È·¶¨µÄº¯ÊýÖУ¬ÀýÈ磺printfº¯Êý¡£
¡¾Ê¹Ó÷½·¨¡¿
²Î¿¼£ºglib/manual/Add.c
#include <stdarg.h>
#include <stdio.h>
int add_em_up (int count,...)
{
va_list ap;
int i, sum;
va_start (ap, count); /* Initialize the argument list. */
sum = 0;
for (i = 0; i < count; i++)
sum += va_arg (ap, int); /* Get the next argument value. */
va_end (ap); /* Clean up. */
return sum;
}
int main (void)
{
/* This call prints 16. */
printf ("%d\n", add_em_up (3, 5, 5, 6));
/* This call prints 55. */
printf ("%d\n", add_em_up (10, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10));
return 0;
}
ÔËÐнá¹û£º
16
55
¡¾ÊµÏÖ·ÖÎö¡¿
Èç¹ûҪʵÏֿɱä²ÎÊý£¬¹Ø¼üÊÇÎÒÃÇÔõÑù±éÀúº¯ÊýÁбí
£¬Õâ¾ÍÇ£³¶µ½º¯ÊýµÄ²ÎÊýÁ´±íÔÚÕ»ÖеĴæ·Å˳ÐòÎÊÌ⣺
º¯ÊýÈëÕ»µÄ¹ý³Ì´óÖÂÈçÏ£º (¸üÏêϸµÄÄÚÈݲο¼ÕâÀï
)
º¯ÊýµÄ¾Ö²¿±äÁ¿ÈëÕ»£»
ÆäËû±»µ÷º¯ÊýÐÅÏ¢Ö¸ÕëÈëÕ»£»
º¯Êý·µ»ØµØÖ·ÈëÕ»£»
²ÎÊýÁбíÈëÕ»£¬Ë³Ðò´ÓÓÒµ½×ó£»
´ËʱÎÒÃÇ¿ÉÒÔÃ÷È·²ÎÊýÁбíµÄ´æ·Å˳Ðò£¬ÈçÏ£º
ËùÒÔÎÒÃDZØÐëÒªÖªµÀÕ»¶¥²ÎÊýµØÖ·£¬¼´º¯ÊýµÄµÚÒ»¸ö²ÎÊý£»
Ö÷ÒªÒÀ¿¿¶¨ÒåÔÚstdarg.hÖÐÈý¸öºê£º
void va_start( va_list arg_ptr, prev_param ); /*¸ø³öµÚÒ»¸ö²ÎÊýµÄµØÖ·*/
type va_arg( va_list arg_ptr, type ); /*´ÓµÚ¶þ¸ö²ÎÊý¿ªÊ¼È¡£¬Ã¿´Î·µ»ØÒ»¸ö*/
void va_end( va_list arg_ptr ); /*±ê¼
Ïà¹ØÎĵµ£º
1.
¹ØÓÚchar* ºÍconst char*ÒÔ¼°char**ºÍconst char**·Ö±ð×÷Ϊʵ²ÎºÍÐβεÄÎÊÌâ
´«ÖµÊµ¼ÊÉÏÊÇÀàËÆÓÚ¸³ÖµµÄ¡£
Á½¸ö²Ù×÷Êý¶¼ÊÇÖ¸ÏòÏÞ¶¨·û»òÎÞÏÞ¶¨·ûµÄÏàÈÝÀàÐ͵ÄÖ¸Õ룬×ó±ßÖ¸ÕëËùÖ¸ÏòµÄÀàÐͱØÐë¾ßÓÐÓÒ±ßÖ¸ÕëËùÖ¸ÏòÀàÐ͵ÄÈ«²¿ÏÞ¶¨·û¡£ ......
Ò». ÔÚcÖзÖΪÕ⼸¸ö´æ´¢Çø
1.Õ» - ÓɱàÒëÆ÷×Ô¶¯·ÖÅäÊÍ·Å
2.¶Ñ - Ò»°ãÓɳÌÐòÔ±·ÖÅäÊÍ·Å£¬Èô³ÌÐòÔ±²»ÊÍ·Å£¬³ÌÐò½áÊøʱ¿ÉÄÜÓÉOS»ØÊÕ
3.È«¾ÖÇø£¨¾²Ì¬Çø£©£¬È«¾Ö±äÁ¿ºÍ¾²Ì¬±äÁ¿µÄ´æ´¢ÊÇ·ÅÔÚÒ»¿éµÄ£¬³õʼ»¯µÄÈ«¾Ö±äÁ¿ºÍ¾²Ì¬±äÁ¿ÔÚÒ»¿éÇøÓò£¬Î´³õʼ»¯µÄÈ«¾Ö±äÁ¿ºÍδ³õʼ»¯µÄ¾²Ì¬±äÁ¿ÔÚÏàÁÚµÄÁíÒ»¿éÇøÓò¡£- ³ÌÐò½áÊøÊÍ·Å
4.Á ......
gcc£¬gdbµÄʹÓÃ
×÷Õߣºzccst
ÉÏÖÜÎåÔÚͼÊé¹Ý½èÁËÒ»±¾¡¶LinuxÈí¼þ¹¤³Ìʦ£¨CÓïÑÔ£©ÊµÓý̡̳·£¬ÈÃÎÒÊÕ»ñÁ¼¶à¡£²»½ö½öÊÇÊéÖеÄ֪ʶ£¬»¹ÓжÔ֪ʶÌåϵºÍ¼Ü¹¹ÈÏʶµÄÉîÈë¡£
LinuxÏÂC¿ª·¢£º
1£¬gcc,gdbµÄʹÓá£
2£¬MakefileÎļþµÄ±àд¡£
3£¬ÏµÍ³º¯ÊýµÄʹÓÃ
4£¬Îļþ²Ù×÷
5£¬´®ÐÐͨÐÅ
6£¬½ø³Ì¿ØÖÆ
7£¬½ø³Ì¼ ......
1.½éÉÜÒ»ÏÂSTL£¬Ïêϸ˵Ã÷STLÈçºÎʵÏÖvector.
Answer£º
STL £¨±ê׼ģ°æ¿â£¬Standard Template Library.ËüÓÉÈÝÆ÷Ëã·¨µü´úÆ÷×é³É¡£
STLÓÐÒÔϵÄһЩÓŵ㣺¿ÉÒÔ·½±ãÈÝÒ×µØʵÏÖËÑË÷Êý¾Ý»ò¶ÔÊý¾ÝÅÅÐòµÈһϵÁеÄËã·¨£»µ÷ÊÔ³ÌÐòʱ¸ü¼Ó°²È« ºÍ·½±ã£»¼´Ê¹ÊÇÈËÃÇÓÃSTLÔÚ ......
Java¿çƽ̨µÄÌØÐÔʹJavaÔ½À´Ô½ÊÜ¿ª·¢ÈËÔ±µÄ»¶Ó£¬µ«Ò²ÍùÍù»áÌýµ½²»Éٵı§Ô¹£ºÓÃJava¿ª·¢µÄͼÐÎÓû§´°¿Ú½çÃæÿ´ÎÔÚÆô¶¯µÄʱºò¶¼»áÌø³öÒ»¸ö¿ØÖÆ̨´°¿Ú£¬Õâ¸ö¿ØÖÆ̨´°¿ÚÈñ¾À´·Ç³£°ôµÄ½çÃæʧɫ²»ÉÙ¡£ÔõôÄܹ»ÈÃͨ¹ýJava¿ª·¢µÄGUI³ÌÐò²»µ¯³öJavaµÄ¿ØÖÆ̨´°¿ÚÄØ£¿ÆäʵÏÖÔںܶàÁ÷ÐеĿª·¢»·¾³ÀýÈçJBuilder¡¢Eclipse¶¼ÊÇʹÓô¿Java ......