c vaϵÁкêµÄ»ù±¾Ó÷¨
vaϵÁкêµÄÓ÷¨µÄÒ»°ã²½Ö裺
vsptr(char *format, ...) //ÇмǴ˴¦µÄ¸ñʽ
{
va_list argptr;
va_start(argptr, format); //ʹµÃargptrÖ¸ÏòÒÔformat¿ªÍ·µÄ´æ´¢¿Õ¼ä
va_arg(argptr, type); //È¡´«µÝµÄ²ÎÊý
...
va_end(argptr); //½áÊø£¬ÊÍ·ÅargptrËùÕ¼ÓõÄÄÚ´æ¿Õ¼ä
}
ÅжÏargptrËùÖ¸ÏòµÄ²ÎÊýÊÇ·ñÒѾȡÍêÁ˵ķ½·¨£º1-¿ÉÒÔ´«µÝµÄ¸öÊý 2-²ÉÓÃvsprintf/vsnprintfϵÁеĺ¯Êý(¿ÉÒÔ½«ËùÓеIJÎÊýÒ»´ÎÈ¥Íê)£¬¸Ãº¯ÊýµÄ³£ÓÃÓ÷¨ÈçÏÂʾÀý£º
#include<stdio.h>
#include <stdarg.h>
#define bufsize 80
char buffer[bufsize];
int vspf(char *fmt, ...)
{
va_list argptr;
int cnt;
va_start(argptr, fmt);
cnt = vsnprintf(buffer,bufsize ,fmt, argptr);
va_end(argptr);
return(cnt);
}
int main(void)
{
int inumber = 30;
float fnumber = 90.0;
char string[4] = "abc";
vspf("%d %f %s", inumber, fnumber, string);
printf("%s\n", buffer);
return 0;
}
Ïà¹ØÎĵµ£º
6.1 ±àдһ¸ö³ÌÐò,´´½¨Ò»¸ö¾ßÓÐ26¸öÔªËصÄÊý×é,²¢ÔÚÆäÖд洢26¸öСд×Öĸ,²¢ÈøóÌÐòÏÔʾ¸ÃÊý×éµÄÄÚÈÝ.
#include <stdio.h>
int main(void)
{
char a[26] = {'a', 'b', 'c', 'd', 'e', 'f',
'g', 'h', 'i', 'j', 'k', 'l',
'm', 'n', 'o', 'p ......
ÎÒÒ»Ö±Ïë×öÒ»¸öÈí¼þ³öÀ´£¬Ö»ÊǼòµ¥µÄ£¬±ÈÈç˵һ¸ö¼Ó¼õ³Ë³ýµÄEXE¡£¿ÉÊÇÎÒÖªµÀÎÒ´íÁË£¬ÎÒ×î½üÑ¡ÐÞÁËÒ»Ãŵç×Ó¹¤³ÌÉè¼ÆÓëÖÆ×÷ºó²ÅÁ˽â±à³ÌµÄÄ¿µÄºÍ¹¤¾ßµÄ¶àÑùÐÔ¡£²»Í¬µÄÈí¼þÌṩ²»Í¬µÄ±àÒë»·¾³£¬ÎÒ·¢ÏÖÄ£ÄâÈí¼þµÄÇ¿µÄ¡£ÎÒʱ³£ÏëÎÒÊDz»ÊÇ¿ÉÒÔͨ¹ýÎÒÏÂÔØ°²×°µÄÈí¼þÀ´Ñ§Ï°Ð©Ô´³ÌÐò¡£ÊǵÄÓÐһЩ£¬¿ÉÊÇÍêÈ«¿´²»¶®£¬³ýÁË ......
ÏÂÃæÕâ¸ö³ÌÐòÊä³öʲô£¿
enum {false,true};
int main()
{
int i=1;
do
{
printf("%d\n",i);
i++;
if(i < 15)
continue;
}while(false);
return 0;
}
ÄãÏàÐÅô£¿ÏÂà ......
1.Ö¸ÕëºÍÒýÓÃÓÐʲô·Ö±ð£»Èç¹û´«ÒýÓñȴ«Ö¸Õ밲ȫ£¬ÎªÊ²Ã´£¿Èç¹ûÎÒʹÓó£Á¿Ö¸ÕëÄѵÀ²»ÐÐÂð£¿
(1) ÒýÓÃÔÚ´´½¨µÄͬʱ±ØÐë³õʼ»¯£¬¼´ÒýÓõ½Ò»¸öÓÐЧµÄ¶ÔÏ󣻶øÖ¸ÕëÔÚ¶¨ÒåµÄʱºò²»±Ø³õʼ»¯£¬¿ÉÒÔÔÚ¶¨ÒåºóÃæµÄÈκεط½ÖØи³Öµ£®
(2) ²»´æÔڣΣգ̣ÌÒýÓã¬ÒýÓÃ±Ø ......
ÎÊ£º
ÔÚ¹¹Ôì»òÎö¹¹ÆÚ¼äÄÜʹÓÃÐ麯ÊýÂð£¿
´ð£º
ÄÜ£¬µ«×îºÃ²»ÒªÕâô×ö¡£
Ç°Á½ÌìÔÚ¹«Ë¾ÓÎÏ·ÏîÄ¿¿ª·¢¹ý³ÌÖУ¬ÔÚÎö¹¹º¯ÊýÖв»Ð¡Ðĵ÷ÓÃÁËÐ麯Êý£¬¶øÇÒ»¹ÊǸö´¿Ð麯Êý¡£
ÒòΪһֱÊÇÔÚRleaseģʽϹ¤×÷µÄ£¬µ¼ÖÂϵͳֱ½ÓÖÕÖ¹¿Í»§¶Ë£¬ËäÈ»¿ØÖÆ̨ÓдòÓ¡Õâ¸ö´íÎ󣬵«ÖÕֹ̫¿ì£¬Ò²Ã»¿´µ½¡£Çл»ÔÚDebugϵ÷ÊÔ£¬Ôò»á±¨R6025 -pure vir ......