[ÃæÊÔÌâ]C»ù´¡ÌâÄ¿
±àÕß°´:·Ç³£»ù±¾¹ØÓÚCÓïÑÔµÄÎÊÌâ,Ò»¸öÐÅÏ¢Àà(¼ÆËã»ú,×ÊѶ¹¤³Ì,µç×Ó¹¤³Ì, ͨÐÅ
¹¤³Ì)רҵµÄ±¾¿Æ±ÏÒµÉúÓ¦¸Ã´ïµ½µÄˮƽ¡£ÌâÄ¿²»ÄÑ,È«²¿¶¼ÄÜ¿ìËٵشðÍ꣬µ±È»Ò²ÐèÒª
Ò»¶¨µÄ֪ʶ´¢±¸¡£
¶ÔÓÚ´ó¶àÊýÈË£¬ÎÒÃÇÔ¤ÆÚÄã¿ÉÄÜ´ð´í 1) 4) 15)Ì⣬ËùÒÔ´ð´í3µÀÒÔÄڵģ¬ÎÒÃÇÈÏΪ
ÄãºÜ°ô
´ð´í5µÀÌâÒÔÄÚ£¬ÎÒÃÇÈÏΪÄ㻹²»´í(Ä㻹¿ÉÄÜ´ð´íµÚ9Ìâ)
Èç¹ûÄãÓÐ6µÀÒÔÉϵÄÌâÄ¿²»ÄÜ´ð¶Ô,»ù±¾ÉÏÎÒÃǶ¼²»ºÃ˵ʲôÁË....
Ô¼¶¨:
1) ÏÂÃæµÄ²âÊÔÌâÖУ¬ÈÏΪËùÓбØÐëµÄÍ·Îļþ¶¼ÒѾÕýÈ·µÄ°üº¬ÁË
2)Êý¾ÝÀàÐÍ
char Ò»¸ö×Ö½Ú 1 byte
int Á½¸ö×Ö½Ú 2 byte (16λϵͳ £¬ÈÏΪÕûÐÍÊÇ2¸ö×Ö½Ú)
long int Ëĸö×Ö½Ú 4 byte
float Ëĸö×Ö½Ú4 byet
double °Ë¸ö×Ö½Ú 8 byte
long double Ê®¸ö×Ö½Ú 10 byte
pointer Á½¸ö×Ö½Ú 2 byte(×¢Ò⣬16λϵͳ,µØÖ·×ÜÏßÖ»ÓÐ16λ)
µÚ1Ìâ: ¿¼²é¶Ôvolatile¹Ø¼ü×ÖµÄÈÏʶ
#include
static jmp_buf buf;
main()
{
volatile int b;
b =3;
if(setjmp(buf)!=0)
{
printf("%d ", b);
exit(0);
}
b=5;
longjmp(buf , 1);
}
ÇëÎÊ£¬Õâ¶Î³ÌÐòµÄÊä³öÊÇ
(a) 3
(b) 5
(c) 0
(d) ÒÔÉϾù²»ÊÇ
µÚ2Ìâ:¿¼²éÀàÐÍת»»
main()
{
struct node
{
int a;
int b;
int c;
};
struct node s= { 3, 5,6 };
struct node *pt = &s;
printf("%d" , *(int*)pt);
}
Õâ¶Î³ÌÐòµÄÊä³öÊÇ:
(a) 3
(b) 5
(c)
Ïà¹ØÎĵµ£º
Delphi Óë C/C++ Êý¾ÝÀàÐͶÔÕÕ±í
DelphiÊý¾ÝÀàÐÍC/C++
ShorInt
8λÓзûºÅÕûÊý
char
Byte
8λÎÞ·ûºÅÕûÊý
BYTE,unsigned short
SmallInt
16λÓзûºÅÕûÊý
short
Word
16λÎÞ·ûºÅÕûÊý
unsigned short
Integer,LongInt
32λÓзûºÅÕûÊý
int,long
Cardinal,LongWord/DWORD
32λÎÞ·ûºÅÕûÊý
unsigned long
Int6 ......
C±ê×¼ÖеÄI/O¿âÊÇÒ»¸ö±È½ÏÅÓ´óµÄ¿â£¬ÊµÏÖÒ²±È½Ï¸´ÔÓ¡£ÏÔÈ»I/O¿âµÄʵÏÖÊÇÒÀÀµÓÚ²Ù×÷ϵͳµÄ£¬²»Í¬µÄϵͳÉÏI/O¿âµÄʵÏÖ»úÀíÊDz»Ò»ÑùµÄ¡£glibcÖУ¬I/O¿âµÄºËÐÄʵÏÖÔÚlibioĿ¼Ï¡£ÓÐ4¸öÍ·Îļþlibio.h, iolibio.h, libioP.h, strfile.h, stdio.h£¬ÆäÖÐstdio.hÊǵ¼³öµÄ±ê×¼CÍ·Îļþ£¬ÆäÓ඼ÊÇÄÚ²¿ÊµÏÖ¡£ÕâÀï²¢² ......
LinuxÏ»ñµÃϵͳʱ¼äµÄCÓïÑÔµÄʵÏÖ·½·¨
#include<time.h> //CÓïÑÔµÄÍ·Îļþ
#include<stdio.h> //C﵀I/O
void main()
{
time_t now; //ʵÀý»¯time_t½á¹¹
struct tm *timenow; //ʵÀý»¯tm½á¹¹Ö¸Õë
time(&now);
//timeº¯Êý¶ÁÈ¡ÏÖÔÚµ ......
ÄÚ´æ·ÖÅ䷽ʽÓÐÈýÖÖ£º
£¨1£© ´Ó¾²Ì¬´æ´¢ÇøÓò·ÖÅä¡£ÄÚ´æÔÚ³ÌÐò±àÒëµÄʱºò¾ÍÒѾ·ÖÅäºÃ£¬Õâ¿éÄÚ´æÔÚ³ÌÐòµÄ
Õû¸öÔËÐÐÆڼ䶼´æÔÚ¡£ÀýÈçÈ«¾Ö±äÁ¿£¬static ±äÁ¿¡£
£¨2£© ÔÚÕ»ÉÏ´´½¨¡£ÔÚÖ´Ðк¯Êýʱ£¬º¯ÊýÄÚ¾Ö²¿±äÁ¿µÄ´æ´¢µ¥Ôª¶¼¿ÉÒÔÔÚÕ»ÉÏ´´½¨£¬º¯
ÊýÖ´ÐнáÊøʱÕâЩ´æ´¢µ¥Ôª×Ô¶¯±»ÊÍ·Å¡£Õ»ÄÚ´æ·ÖÅäÔËËãÄÚÖÃÓÚ´¦ÀíÆ÷µ ......
extern "C"
¡¡¡¡extern "C" °üº¬Ë«Öغ¬Ò壬´Ó×ÖÃæÉϼ´¿ÉµÃµ½£ºÊ×ÏÈ£¬±»ËüÐÞÊεÄÄ¿±êÊÇ“extern”µÄ£»Æä´Î£¬±»ËüÐÞÊεÄÄ¿±êÊÇ“C”µÄ¡£ÈÃÎÒÃÇÀ´Ïêϸ½â¶ÁÕâÁ½Öغ¬Òå¡£
¡¡¡¡£¨1£© ±»extern "C"ÏÞ¶¨µÄº¯Êý»ò±äÁ¿ÊÇexternÀàÐ͵ģ»
¡¡¡¡externÊÇC/C++ÓïÑÔÖбíÃ÷º¯ÊýºÍÈ«¾Ö±äÁ¿×÷Ó÷¶Î§£¨¿É¼ûÐÔ£©µÄ¹Ø¼ü×Ö£ ......