CÕûÐÍÉý¼¶ºÍѰ³£ËãÊõת»»
ANSI CÖеÄÕûÐÍÉý¼¶
char£¬short int»òÕßintÐÍλ¶Î£¨bit-field£©£¬°üÀ¨ËüÃǵÄÓзûºÅ»òÎÞ·ûºÅ±äÐÍ£¬
ÒÔ¼°Ã¶¾ÙÀàÐÍ£¬¿ÉÒÔʹÓÃÔÚÐèÒªint»òunsigned intµÄ±í´ïʽÖУ¬
Èç¹ûint¿ÉÒÔÍêÕûµØ±íʾԴÀàÐ͵ÄËùÓÐÖµ£¬ÄÇô¸ÃÀàÐ͵ÄÖµ¾Íת»»Îªint£¬·ñÔòת»»Îªunsigned int¡£
ANSI CÖеÄѰ³£ËãÊõת»»
µ±Ö´ÐÐËãÊõÔËËãʱ£¬²Ù×÷ÊýµÄÀàÐÍÈç¹û²»Í¬£¬¾Í»á·¢Éúת»»¡£
Êý¾ÝÀàÐÍÒ»°ã³¯×Ÿ¡µã¾«¶È¸ü¸ß¡¢³¤¶È¸ü³¤µÄ·½Ïòת»»£¬
ÕûÐÍÊýÈç¹ûת»»Îªsigned²»»á¶ªÊ§ÐÅÏ¢£¬¾Íת»»Îªsigned£¬·ñÔò¾Íת»»Îªunsigned¡£
Õâ¸ö³ÆÎªÖµ±£Áô£¨value preserving£©ÔÔò£¬ÓëK&R CËù²ÉÓõÄÎÞ·ûºÅ±£Áô£¨unsigned preserving£©ÔÔò²»Í¬¡£
¸¡µãÀà:
Èç¹ûÒ»¸ö²Ù×÷ÊýµÄÀàÐÍÊÇlong double£¬ÄÇôÁíÒ»¸ö²Ù×÷ÊýÎÞÂÛÊÇʲôÀàÐͶ¼½«±»×ª»»³Élong double¡£
Èç¹ûÁ½¸ö²Ù×÷Êý¶¼²»ÊÇlong doubleÐÍ£¬ÄÇôµ±ÆäÖÐÒ»¸ö²Ù×÷ÊýµÄÀàÐÍÊÇdoubleÐÍ£¬ÔòÁíÒ»¸ö¾Í½«±»×ª»»³Édouble ÐÍ¡£
Èç¹ûÁ½¸ö²Ù×÷Êý¶¼²»ÊÇdoubleÐÍ£¬¶øÆäÖÐÒ»¸ö²Ù×÷ÊýÊÇfloatÐÍ£¬ÔòÁíÒ»¸ö±»×ª»»³ÉfloatÐÍ¡£
×¢Ò⣺doubleºÍfloat¶¼²»¿ÉÓÃunsigned,shortÐÞÊΣ¬ÁíÍâfloat»¹²»¿ÉÓÃlongÐÞÊÎ
ÕûÐÎÀà¹æ:
·ñÔò£¬Á½¸ö²Ù×÷Êý¶¼²»ÊÇÈýÖÖ¸¡µãÀàÐÍÖ®Ò»£¬ËüÃÇÒ»¶¨ÊÇijÖÖÕûÖµÀàÐÍ¡£ÔÚÈ·¶¨¹²Í¬µÄÄ¿±êÌáÉýÀàÐÍ֮ǰ£¬±àÒëÆ÷½«ÔÚËùÓÐСÓÚintµÄÕûÖµÀàÐÍÉÏÊ©¼ÓÒ»¸ö±»³ÆÎªÕûÖµÌáÉý(integral promotion)µÄ¹ý³Ì¡£ÔÚ½øÐÐÕûÖµÌáÉýʱ£¬ÀàÐÍ(char¡¢signed char¡¢unsigned charºÍshort¡¢int)¶¼±»ÌáÉýΪÀàÐÍint¡£Èç¹û»úÆ÷ÉϵÄintÐÍ×ã¹»±íʾËùÓÐunsigned¡¢shoftÐ͵ÄÖµ(Õâͨ³£·¢ÉúÔÚshortÓðë¸ö×Ö±íʾ£¬¶øintÓÃÒ»¸ö×Ö±íʾµÄÇé¿öÏÂ)£¬Ôòunsigned short intÒ²±»×ª»»³Éint£¬·ñÔòËü»á±»ÌáÉýΪunsigned int¡£
wchar_tºÍö¾ÙÀàÐͱ»ÌáÉýΪÄܹ»±íʾÆäµ×²ãÀàÐÍ(underlying type)ËùÓÐÖµµÄ×îСÕûÊýÀàÐÍ¡£
Ò»µ©ÕûÖµÌáÉýÖ´ÐÐÍê±Ï£¬ÀàÐͱȽϾÍÓÖÒ»´Î¿ªÊ¼¡£Èç¹ûÒ»¸ö²Ù×÷ÊýÊÇunsigned longÐÍ£¬ÔòµÚ¶þ¸öÒ²±»×ª»»³Éunsigned longÐÍ¡£Èç¹ûÁ½¸ö²Ù×÷ÊýµÄÀàÐͶ¼²»ÊÇunsigned long£¬¶øÆäÖÐÒ»¸ö²Ù×÷ÊýÊÇ
Ïà¹ØÎĵµ£º
Data Type Ranges
C/C++ recognizes the types shown in the table below.
Type Name Bytes Other Names Range of Values
&nb ......
C³ÌÐòÖоßÓзḻµÄÊý¾ÝÀàÐÍ£¬°üÀ¨ÉùÃ÷ÖÐÏÔʽ¶¨ÒåµÄÀàÐͺÍÓÃ×ö±í´ïʽÖмäÀàÐ͵ĵ¼³öÀàÐÍ¡£ÀýÈ磬ÏÂÃæµÄ¸³ÖµÓï¾ä°üº¬3 ÖÖ²»Í¬ÀàÐÍ:
int *p, x;
*p = x;
xÊÇÒ»¸ö´æ·ÅÕûÊýµÄµ¥ÔªµÄµØÖ·£¬Òò´ËxµÄµØÖ·µÄÀàÐÍÊÇ£ºÖ¸ÏòÒ»¸öÕûÊýµÄÖ¸Õë¡£xµÄÖµµÄÀàÐÍÊÇÕûÐÍ¡£Í¬Ñù, pµÄ×óÖµµÄÀàÐÍÊÇÖ¸ÏòÒ»¸öÕ ......
#include <stdio.h>
#define N 19
int main()
{
int i;
for (i=0;i<=N;i++)
{
printf("%*.*s%-*.*s\n",N,i<=N/2?i:N-1,"*******************",\
N,i<=N/2?i+1:N-i+1,"*******************");
}
return 0;
}
%m.ns ......
¸ãÈí¼þÊÇÓиãÍ·µÄ
——×ÞÆî·å
2009Äê12ÔÂ3ÈÕ
ÉùÃ÷£ºËù˵µÄÖ»Õë¶ÔC¡¢C++¡¢.NETרҵµÄͬѧ£¬¶ÔÆäËûרҵҲÐíûÓвο¼¼ÛÖµ£¡
[ÍÆ¼ö¸ø´óÈýµÄѧµÜѧÃÃÃÇ]
¡¾»¶Ó¸÷λÅóÓѲ¹³ä¡¿
¶ÔÎÒ¸öÈ˶øÑÔ£¬´óѧ±ÏÒµÕÒ¹¤×÷ËãÊÇ»ÉÏÁËÒ»¸öÐí¶àÈËÏÛĽ£¬µ«ÎÒ×Ô¼ºÈÔ¸ÐÒź¶µÄ¾äºÅ¡£ÕÒ¹¤×÷ÆÚ¼ä ......
#include "stdafx.h"
#include <stdio.h>
#include <windows.h>
#include <math.h>
#include <conio.h>
typedef struct {
short int pitch;
short int duration;
} NOTE;
NOTE notes[] = {{14, 500}, {16, 500}, {12, 500 ......