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:"\@ËÎÌå";
panose-1:2 1 6 0 3 1 1 1 1 1;
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:ˎ̥;
panose-1:0 0 0 0 0 0 0 0 0 0;
mso-font-alt:"Times New Roman";
mso-font-charset:0;
mso-generic-font-family:roman;
mso-font-format:other;
mso-font-pitch:auto;
mso-font-signature:0 0 0 0 0 0;}
/* Style Definitions */
p.MsoNormal, li.MsoNormal, div.MsoNormal
{mso-style-parent:"";
margin:0cm;
margin-bottom:.0001pt;
text-align:justify;
text-justify:inter-ideograph;
mso-pagination:none;
font-size:10.5pt;
mso-bidi-font-size:12.0pt;
font-family:"Times New Roman";
mso-fareast-font-family:ËÎÌå;
mso-font-kerning:1.0pt;}
/* Page Definitions */
@page
{mso-page-border-surround-header:no;
mso-page-border-surround-footer:no;}
@page Section1
{size:612.0pt 792.0pt;
margin:72.0pt 90.0pt 72.0pt 90.0pt;
mso-header-margin:36.0pt;
mso-footer-margin:36.0pt;
mso-paper-source:0;}
div.Section1
{page:Section1;}
-->
À´Ô´Ò»
:Using typedef to Curb Miscreant Code
Typedef
ÉùÃ÷ÓÐÖúÓÚ´´½¨Æ½Ì¨ÎÞ¹ØÀàÐÍ£¬ÉõÖÁÄÜÒþ²Ø¸´ÔÓºÍÄÑÒÔÀí½âµÄÓï·¨¡£²»¹ÜÔõÑù£¬Ê¹ÓÃ
typedef
ÄÜΪ´úÂë´øÀ´ÒâÏë²»µ½µÄºÃ´¦£¬Í¨¹ý±¾ÎÄÄã¿ÉÒÔѧϰÓÃ
typedef
±ÜÃâȱǷ£¬´Ó¶øÊ¹´úÂë¸ü½¡×³¡£
typedef
ÉùÃ÷£¬¼ò³Æ
typedef
£¬ÎªÏÖÓÐÀàÐÍ´´½¨Ò»¸öеÄÃû×Ö¡£±ÈÈçÈËÃdz£³£Ê¹ÓÃ
typedef
À´±àд¸üÃÀ¹ÛºÍ¿É¶ÁµÄ´úÂë¡£ËùνÃÀ¹Û£¬ÒâÖ¸
typedef
ÄÜÒþ²Ø±¿×¾µÄÓï·¨¹¹ÔìÒÔ¼°Æ½Ì¨Ïà¹ØµÄÊý¾ÝÀàÐÍ£¬´Ó¶øÔöÇ¿¿ÉÒÆÖ²ÐÔºÍÒÔ¼°Î´À´µÄ¿Éά»¤ÐÔ¡£±¾ÎÄÏÂÃæ½«½ß¾¡È«Á¦À´½Òʾ
typedef
Ç¿´ó¹¦ÄÜÒÔ¼°ÈçºÎ±ÜÃâһЩ³£¼ûµÄÏÝÚå¡£
ÈçºÎ´´½¨Æ½Ì¨Î޹صÄÊý¾ÝÀàÐÍ£¬Òþ²Ø±¿×¾ÇÒÄÑÒÔÀí½âµÄÓï·¨
?
Ïà¹ØÎĵµ£º
#include<stdio.h>
#include<malloc.h>
#include<string.h>
/*
* ·×ª
*/
char *mystrrev(char *arr)
{
if (!arr)
{
return NULL;
}
char *temp = arr;
char t;
int leng = strlen(arr) + 1;
int l = (int)(leng / 2);
int i = 0;
while (l--)
{
t = arr[i];
arr[ ......
Ö¸ÕëÊÇC/C++ÓïÑÔµÄÌØÉ«£¬¶øÊý×éÃûÓëÖ¸ÕëÓÐÌ«¶àµÄÏàËÆ£¬ÉõÖÁºÜ¶àʱºò£¬Êý×éÃû¿ÉÒÔ×÷ΪָÕëʹÓá£ÓÚÊǺõ£¬ºÜ¶à³ÌÐòÉè¼ÆÕ߾ͱ»¸ãºýÍ¿ÁË¡£¶øÐí¶àµÄ´óѧÀÏʦ£¬ËûÃÇÔÚCÓïÑԵĽÌѧ¹ý³ÌÖÐÒ²´íÎóµÃ¸øÑ§Éú½²½â£º"Êý×éÃû¾ÍÊÇÖ¸Õë"¡£ºÜÐÒÔË£¬ÎҵĴóѧÀÏʦ¾ÍÊÇÆäÖÐÖ®Ò»¡£Ê±ÖÁ½ñÈÕ£¬ÎÒÈÕ¸´Ò»ÈյؽøÐÐ×ÅC/C++ÏîÄ¿µÄ¿ª·¢£¬¶øÉí±ß»¹Ò»Ö±³äÂúÕ ......
ǰÌìдһ¸öС³ÌÐò, ͻȻ·¢ÏÖÆäʵżµÄCѧµÄ²»ÔõôÑù°¡£¬ºÃ¶àº¯Êý¶¼²»¼ÇµÃ£¬ÔÚÍøÉÏËѵ½µÄ¶¼ÊÇЩÂÒÆß°ËÔãµÄ£¬Ã»ÓÐÔÐÍ£¬ÓÃÆðÀ´²»·ÅÐÄ£¬ÓãÅÎÄËÑ£¬Ëѵ½ÕæÕýµÄBible——
The GNU C Library Manual
ÕâÀïÃæÌ«È«ÁË£¬Ö»ÊÇÓÐÒ»µã²»Ì«ºÃ£¬£ÅÎĵ쬶ÁÆðÀ´ÓеãÂý£¬¸Ð¾õÓеãÀË·Ñʱ¼ä
ÓãÃдÁ˶ÎС³ÌÐò°ÑÒ»¸öÎå±ÊÂëÎı¾Îĵµ×ª ......
1.ÇóÏÂÃæº¯ÊýµÄ·µ»ØÖµ£¨Î¢Èí£©
int func(x)
{
int countx = 0;
while(x)
{
countx ++;
x = x&(x-1);
}
......
CÓïÑÔÖÐÓм¸¸ö»ù±¾ÊäÈ뺯Êý£º
//»ñÈ¡×Ö·ûϵÁÐ
int fgetc(FILE *stream);
int getc(FILE *stream);
int getchar(void);
//»ñÈ¡ÐÐϵÁÐ
char *fgets(char * restrict s, int n, FILE * restrict stream);
char *gets(char *s);//¿ÉÄܵ¼ÖÂÒç³ö£¬ÓÃfgets´úÌæÖ®¡£
//¸ñʽ»¯ÊäÈëϵÁÐ
int fscanf(FILE * r ......