CÖеĿɱä²ÎÊýÑо¿
CÖеĿɱä²ÎÊýÑо¿
Ò»£® ºÎν¿É±ä²ÎÊý
int printf(const char* format, ...);
ÕâÊÇʹÓùýCÓïÑÔµÄÈËËùÔÙÊìϤ²»¹ýµÄprintfº¯ÊýÔÐÍ£¬ËüµÄ²ÎÊýÖоÍÓй̶¨²ÎÊýformatºÍ¿É±ä²ÎÊý£¨ÓÔ…”±íʾ£©. ¶øÎÒÃÇÓÖ¿ÉÒÔÓø÷ÖÖ·½Ê½À´µ÷ÓÃprintf,Èç:
printf("%d",value);
printf("%s",str);
printf("the number is %d ,string is:%s", value, str);
¶þ. ʵÏÖÔÀí
CÓïÑÔÓúêÀ´´¦ÀíÕâЩ¿É±ä²ÎÊý¡£ÕâЩºê¿´ÆðÀ´ºÜ¸´ÔÓ£¬ÆäʵÔÀíͦ¼òµ¥£¬¾ÍÊǸù¾Ý²ÎÊýÈëÕ»µÄÌصã´Ó×î¿¿½üµÚÒ»¸ö¿É±ä²ÎÊýµÄ¹Ì¶¨²ÎÊý¿ªÊ¼£¬ÒÀ´Î»ñȡÿ¸ö¿É±ä²Î
ÊýµÄµØÖ·¡£ÏÂÃæÎÒÃÇÀ´·ÖÎöÕâЩºê¡£ÔÚVCÖеÄstdarg.hÍ·ÎļþÖУ¬Õë¶Ô²»Í¬Æ½Ì¨Óв»Í¬µÄºê¶¨Ò壬ÎÒÃÇÑ¡È¡X86ƽ̨ϵĺ궨Ò壺
typedef char *va_list;
/*°Ñva_list±»¶¨Òå³Échar*£¬ÕâÊÇÒòΪÔÚÎÒÃÇÄ¿Ç°ËùÓõÄPC»úÉÏ£¬×Ö·ûÖ¸ÕëÀàÐÍ¿ÉÒÔÓÃÀ´´æ´¢ÄÚ´æµ¥ÔªµØÖ·¡£¶øÔÚÓеĻúÆ÷ÉÏva_listÊDZ»¶¨Òå³Évoid*µÄ*/
#define _INTSIZEOF(n) ( (sizeof(n) + sizeof(int) - 1) & ~(sizeof(int) - 1) )
/*_INTSIZEOF(n)ºêÊÇΪÁË¿¼ÂÇÄÇЩÄÚ´æµØÖ·ÐèÒª¶ÔÆëµÄϵͳ£¬´ÓºêµÄÃû×ÖÀ´Ó¦¸ÃÊǸúsizeof(int)¶ÔÆë¡£Ò»°ãµÄ
sizeof(int)=4£¬Ò²¾ÍÊDzÎÊýÔÚÄÚ´æÖеĵØÖ·¶¼Îª4µÄ±¶Êý¡£±ÈÈ磬Èç¹ûsizeof(n)ÔÚ1£4Ö®¼ä£¬ÄÇô_INTSIZEOF(n)£½4£»
Èç¹ûsizeof(n)ÔÚ5£8Ö®¼ä£¬ÄÇô_INTSIZEOF(n)=8¡£*/
#define va_start(ap,v)( ap = (va_list)&v + _INTSIZEOF(v) )
/*va_startµÄ¶¨ÒåΪ&nb
Ïà¹ØÎĵµ£º
ÓÃÊéÉϵĴúÂëÆ´´ÕµÄ£¬»¹ÊǺÜÓгɾ͸еĹþ
Ö§³ÖµÄÔËËã·ûºÅÓÐ"+","-","*","/","(",")","#"¡£
Ö§³Ö20λÒÔÄÚÎÞ·ûºÅÕûÊý£¬µ±È»¿ÉÒÔºÜÈÝÒ׵ĸijÉÓзûºÅ»òÕßÊÇʵÐÍÊý
#include<stdio.h>
#include<string.h>
#include<stdlib.h>
#define OPSETSIZE 7
//º¯Êý½á¹û״̬´úÂë
#define TRUE 1
#define FALSE 0 ......
7.2.1 ½éÉÜgetchar()ºÍputchar()
Ç°ÃæµÄ¶àÊý³ÌÐòËùÊäÈëµÄÄÚÈݶ¼ÊÇÊý×Ö¡£ÎªÁËÁ·Ï°Ê¹ÓÃÆäËûµÄÐÎʽ£¬ÈÃÎÒÃÇÀ´¿´Ò»¸öÃæÏò×Ö·ûµÄÀý×Ó¡£
ÏÖÔÚÎÒÃǽ«½Ó´¥×¨ÃÅΪÃæÏò×Ö·ûI/O¶øÉè¼ÆµÄÒ»¶ÔCº¯Êý£ºgetchar()ºÍputchar()¡£
.
getchar()º¯ÊýûÓвÎÊý£¬Ëü·µ»ØÀ´×ÔÊäÈëÉ豸µÄÏÂÒ»¸ö×Ö·û¡£ÀýÈ磬ÏÂÃæµÄÓï¾ä¶ÁÈ¡ÏÂÒ»¸öÊäÈë×Ö·û²¢½«ËüµÄÖµ ......
ΪÁËʹÓÃCÓïÑÔ±à³ÌÖ±½Ó¶ÁÈ¡dbfÎļþ£¬ÐèÒªÁ˽âdbfÎļþµÄ¶þ½øÖÆÎļþ¸ñʽ£¬ÏÂÃæ¸ø³ö¼òÒªµÄ˵Ã÷¡£
±íÎļþÓÉÍ·¼Ç¼¼°Êý¾Ý¼Ç¼×é³É¡£Í·¼Ç¼¶¨Òå¸Ã±íµÄ½á¹¹²¢°üº¬Óë±íÏà¹ØµÄÆäËûÐÅÏ¢¡£Í·¼Ç¼ÓÉÎļþλÖà 0 ¿ªÊ¼¡£Êý¾Ý¼Ç¼1½ô½ÓÔÚÍ·¼Ç¼֮ºó£¨Á¬ÐøµÄ×Ö½Ú£©£¬°üº¬×Ö¶ÎÖÐʵ¼ÊµÄÎı¾¡£
¼Ç¼µÄ³¤¶È£¨ÒÔ×Ö½ÚΪµ¥Î»£©µÈÓÚËùÓÐ×ֶζ¨Òå ......
ÍøÓѹ۵ã:
(Ò»):
ÎÒÈÏΪºÜ¶àÈËûÓÐÀí½âlinus»òÕßmyanµÄÒâ˼£¬ÎÒ¾Ù¸öʵÀý¡£
ÎÒÃÇÏÖÔÚÒªÉè¼ÆÒ»Ì×ÍøÂ磿ͻ§¶ËÈí¼þ£¬ÎÒÃÇÒªÏÈ°ÑÐÒ鶨ºÃ£¬°Ñ½çÃæºÍºǫ́½»»¥Éè¼ÆÏëºÃ£¬°ÑÈÝ´íºÍ»Ö¸´ÏëºÃ£¬ÎÒÈÏΪÕâЩÊÇ×îÖØÒªµÄ£¬ÖÁÓÚ±àÂ룬ÓÃCÒ²¿ÉÒÔ±à³öÀ´£¬ÓÃC£«£«Ò²¿ÉÒÔ±à³öÀ´£¬ÉõÖÁÓÃJAVAÒ²Äܱà³öÀ´£¬¹Ø¼üÊÇÕû¸öÈí¼þµÄ¼Ü¹¹ÒªÇåÎú£¬Õ ......
ÏÈÓñ´¶ûµÄÒ»µÀ±ÊÊÔÌâ¼òÒªµÄ˵Ã÷һϰɣº
¡¾Ì⡿˵Ã÷ÒÔϳÌÐò¡£
#include
int main(void)
{
unsigned int a[3] = {0x01020304, 0x05060708, 0x090a0b0c};
unsigned int *p = (unsigned int *)((int)a +1);¢Ù
printf("%x\n", *p);
return 0;
}
¡¾ÌâÄ¿½âÎö¡¿
Õâ¶Î³ÌÐòµÄÊä³ö½á¹ûÓ¦ ......