c/C++±àÒëµÄ³ÌÐòÕ¼ÓõÄÄÚ´æÇé¿ö ÎÄ×Ö³£Á¿Çø
Ê×ÏÈ¿´ÏÂÏÂÃæÕâ¶Î£º
int main()
{
char *name = "fengkewei";
char name1[] = "fengkewei";
char *name2 = "fengkewei";
char *name3 = "woaifengkewei";
int i = 10;
int j = 10;
int k = 11;
return 0;
}
ÈôÄú¾õµÃËüÃÇÓ¦¸Ã¶¼±£´æÔÚÄÚ´æÖеÄÒ»¿éµØ·½£¬ÄÇÇëÍùÏ¿´¡£¡£¡£¡£
ÏÂÃæÊDZàÒëÆ÷Ϊ¸÷¸ö±äÁ¿·ÖÅäµÄÄÚ´æµØÖ·£¬ÓÉÓÚ·ÖÅäÔÚÕ»ÉÏ ËùÒÔµØÖ·ÊǵݼõµÄ
---------------------Õ»Çø------------------------------------
+ &name 0x0013ff5c unsigned char * *
+ &name1 0x0013ff48 unsigned char [10]*
+ &name2 0x0013ff3c unsigned char * *
+ &name3 0x0013ff30 unsigned char * *
+ &i 0x0013ff24 int *
+ &j 0x0013ff18 int *
+ &k 0x0013ff0c int *
---------------------------------------------------------------
&name ºÍ&name1[] Ïà²î20¸ö×Ö½Ú µ«"fengkewei"Ö»ÓÐ10¸ö×Ö½Ú£¨´ø¿Õ×Ö·û£©
&name1[]ºÍ&name2 Ïà²î12¸ö×Ö½Ú
ºóÃ涼Õý³£ÁË ¶¼²î12
ΪʲôÊÇ12£¿
————————————————————————————————————————————
ÏÂÃæÊǸ÷×Ö·û´®µÄÊ×µØÖ· ËüÃǶ¼ÔÚÎÄ×Ö³£Á¿ÇøÀï ÏàͬҲ¾ÍÏàͬÁË ²»Í¬ÔòÊǵÝÔö·ÖÅäµÄ£¨ ÎÄ×Ö³£Á¿ÇøÒ²ÊǵÝÔö·ÖÅäµÄ)
---------------------------ÎÄ×Ö³£Á¿Çø-------------------------------------------------
+ name 0x004156b8 "fengkewei" unsigned char *
+ name2 0x004156b8 "fengkewei" unsigned char *
+ name3 0x00416010 "woaifengkewei" unsigned char *
+ name1 0x0013ff48 "fengkewei" unsigned char [10]
¿É¼ûname1[]ÊÇÔÚÒ»¸ö²»Í¬µÄµØ·½µÄ Ò²¾ÍÊÇ˵Ëü¾ÍÊÇÔÚÕ»ÉÏ
ÏÖÔÚÎÒÃÇÉèÖÃÒ»¸öÕûÐÍÖ¸Õë
int *p;
p = &i;
ÄÇpµÄµØÖ·Ó¦¸ÃÊÇÖ¸ÏòiµÄµØÖ·£¬Ö¸ÏòÕ»Çø
¹ûÈ»£º
+ &i 0x0013ff24 int *
+ p 0x0013ff24 int *
----------------------------------------------------------
Ïà¹ØÎĵµ£º
ͨÐÅ
Server£º
#pragma comment(lib, "ws2_32.lib")
#include <Winsock2.h>
#include <stdio.h>
void main()
{
//°æ±¾ÐÉÌ
WORD wVersionRequested;
WSADATA wsaData;
int err;
wVersionRequested = MAKEWORD(1,1); //0x0101
err = WSAStartup ......
ÓÃ#include¿ÉÒÔ°üº¬ÆäËûÍ·ÎļþÖбäÁ¿¡¢º¯ÊýµÄÉùÃ÷£¬ÎªÊ²Ã´»¹Òªextern¹Ø¼ü×Ö,Èç¹ûÎÒÏëÒýÓÃÒ»¸öÈ«¾Ö±äÁ¿»ò
º¯Êýa£¬ÎÒÖ»ÒªÖ±½ÓÔÚÔ´ÎļþÖаüº¬#include<xxx.h>
(xxx.h°üº¬ÁËaµÄÉùÃ÷)²»¾Í¿ÉÒÔÁËô£¬ÎªÊ²Ã´»¹ÒªÓÃexternÄØ£¿£¿Õâ¸öÎÊÌâÒ»Ö±Ò²ÊÇËÆÊǶø·ÇµÄÀ§ÈÅ×ÅÎÒÐí¶àÄêÁË£¬½ñÌìÉÏÍøºÝºÝ²éÁËÒ»ÏÂ×ÜËãСÓÐ
Ëù»ñÁË£º
Í· ......
linux c ¶ÁÈ¡ÎļþÐÐÊý²ÎÕÕwc ϵͳÃüÁî±àдµÄº¯ÊýÈçÏ£º
#include <fcntl.h>
#include <stdlib.h>
#define MAXBSIZE 65536
u_long file_wc(char *file)
{
register u_char *p;
register short gotsp;
register int ch, len;
register u_long linect, charct;
int fd;
u_char buf[MAXBSIZE];
......
һƪ½²¶ÔÆë±È½ÏºÃµÄÎÄÕ£¬×ªÌùÈçÏÂ:
´óÖ±ê×¢Ò»¶þ:
1.ÄÚ´æ¶ÔÆë:¼ÆËã»úϵͳ¶Ô»ù±¾ÀàÐÍÊý¾ÝÔÚÄÚ´æÖдæ·ÅµÄλÖÃÓÐÏÞÖÆ£¬ËüÃÇ»áÒªÇóÕâЩÊý¾ÝµÄÊ×µØÖ·µÄÖµÊÇij¸öÊýk(ͨ³£ËüΪ4»ò8)µÄ±¶ÊýkÔò±»³ÆΪ¸ÃÊý¾ÝÀàÐ͵ĶÔÆëÄ£Êý(alignment modulus)
2.²»Í¬±àÒëÆ÷ĬÈϵÄ×î´ó¶ÔÆë×Ö½ÚÊýÊDz»Ò»ÑùµÄ,±ÈÈçvc==8,gcc==4,¿ÉÒÔͨ¹ ......