¿É±äÄ¿±êC±àÒëÆ÷ µÚ4Õ ÀàÐÍ
C³ÌÐòÖоßÓзḻµÄÊý¾ÝÀàÐÍ£¬°üÀ¨ÉùÃ÷ÖÐÏÔʽ¶¨ÒåµÄÀàÐͺÍÓÃ×ö±í´ïʽÖмäÀàÐ͵ĵ¼³öÀàÐÍ¡£ÀýÈ磬ÏÂÃæµÄ¸³ÖµÓï¾ä°üº¬3 ÖÖ²»Í¬ÀàÐÍ:
int *p, x;
*p = x;
xÊÇÒ»¸ö´æ·ÅÕûÊýµÄµ¥ÔªµÄµØÖ·£¬Òò´ËxµÄµØÖ·µÄÀàÐÍÊÇ£ºÖ¸ÏòÒ»¸öÕûÊýµÄÖ¸Õë¡£xµÄÖµµÄÀàÐÍÊÇÕûÐÍ¡£Í¬Ñù, pµÄ×óÖµµÄÀàÐÍÊÇÖ¸ÏòÒ»¸öÕûÊýµÄÖ¸ÕëµÄÖ¸Õ룬pµÄÓÒÖµµÄÀàÐÍÊÇÖ¸ÏòÒ»¸öÕûÊýµÄÖ¸Õ룬*pµÄÀàÐÍÊÇÕûÊý¡£lccÔÚ±àÒ븳ֵÓï¾äʱ±ØÐë´¦ÀíËùÓÐÕâЩÀàÐÍ¡£
lccʵÏÖÁËÀàÐͱíʾºÍÒ»×é¸Ã±íʾ֮Éϵĺ¯Êý£¬±¾Õ½«¶Ô´Ë½øÐнéÉÜ¡£º¯Êý°üÀ¨´´½¨ÀàÐ͵ÄÀàÐ͹¹Ô캯ÊýÒÔ¼°²âÊÔÀàÐÍ µÄÀàÐͶÏÑÔº¯Êý¡£lcc»¹±ØÐëʵÏÖÀàÐͼì²é£¬È·±£ÉùÃ÷ºÍ±í´ïʽ×ñÊØÓïÑÔÖƶ¨µÄ¹æÔò¡£ÀàÐͼì²éʹÓñ¾Õ½éÉܵĶÏÑÔº¯Êý£¬Ïêϸ²Î¼ûµÚ9Õº͵Ú11Õ¡£
4.1 ÀàÐͱíʾ
CÓïÑÔµÄÀàÐÍͨ³£ÓÃÓ¢ÎĵÄǰ׺ÐÎʽÃè»æ£¬Ëùνǰ׺ÐÎʽ£¬¾ÍÊÇÖ¸ÀàÐͲÙ×÷ÊýÔÚÀàÐͲÙ×÷·ûÖ®ºó³öÏÖ¡£ÀýÈ磬int *pÉùÃ÷pÊÇÒ»¸öÖ¸ÏòintµÄÖ¸Õë,¾ÍÊÇCÀàÐÍint*µÄǰ׺±íʾ£¬Ö¸ÕëÊDzÙ×÷·û£¬intÊDzÙ×÷Êý£¬Í¬Ñù£¬char*(*strings)[10]½«strings˵Ã÷Ϊ:
Ò»¸öÖ¸Õ룬ָÏò
Ò»¸ö´óСΪ10µÄÊý×飬ÿ¸öÊý×éÔªËØÊÇÒ»¸ö
Ö¸Õ룬ָÏò
×Ö·û
²Ù×÷ÊýÔÚËüÃǸ÷×ԵIJÙ×÷·ûÏÂÒÔ½×ÌÝ·½Ê½Ëõ½ø¡£
±íʾÕâÖÖǰ׺ÀàÐ͹淶µÄ·½·¨ÓкܶࡣÀýÈ磬һЩÀϵÄC±àÒëÆ÷ʹÓÃλ´®À´±íʾ£¬ÀàÐͲÙ×÷·ûºÍ»ù±¾ÀàÐÍÓÃÈô¸Éλ±àÂ롣λ´®±íʾ·Ç³£½ô´Õ²¢Ò×ÓÚ²Ù×÷£¬µ«ÊÇÒ»°ã»á¶Ô»ù±¾ºÍ²Ù×÷·ûµÄÊýÄ¿×öÒ»¶¨ÏÞÖÆ£¬²¢ÇÒ²»ÄÜÓµÓбíʾ´óСµÄÊý¾Ý£¬ÀýÈç²»ÄܱíʾÊý×éµÄ´óС¡£
lcc ͨ¹ýÄÜ·´Ó³ÀàÐ͵Äǰ׺¹æ·¶µÄÁ´½Ó½á¹¹À´±íʾÀàÐÍ£¬ÀàÐͽڵ㶨ÒåÈçÏ£º
(types.c typedefs) =
typedef struct type * Type;
(types.c exported types) =
struct type {
int op;
Type type;
int align;
int size;
&
Ïà¹ØÎĵµ£º
ת×Ô£ºhttp://dev.yesky.com/471/2306471.shtml
1.ÒýÑÔ
¡¡¡¡±¾ÎĵÄд×÷Ä¿µÄ²¢²»ÔÚÓÚÌṩC/C++³ÌÐòÔ±ÇóÖ°ÃæÊÔÖ¸µ¼£¬¶øÖ¼ÔÚ´Ó¼¼ÊõÉÏ·ÖÎöÃæÊÔÌâµÄÄÚº¡£ÎÄÖеĴó¶àÊýÃæÊÔÌâÀ´×Ô¸÷´óÂÛ̳£¬²¿·ÖÊÔÌâ½â´ðÒ²²Î¿¼ÁËÍøÓѵÄÒâ¼û¡£
¡¡¡¡Ðí¶àÃæÊÔÌâ¿´ËƼòµ¥£¬È´ÐèÒªÉîºñµÄ»ù±¾¹¦²ÅÄܸø³öÍêÃÀµÄ½â´ð¡£ÆóÒµÒªÇóÃæÊÔÕßдһ¸ö×î¼òµ¥µÄst ......
½ñÌìÒª±à¸ö×î¼òµ¥µÄ"hello world"µÄC³ÌÐò£¬ËãÊdzõ²½¸ÐÊÜÏÂLinuxÖеıà³Ì»·¾³£¬Éæ¼°ÒÔÏÂ3¸ö²½Ö裺
1. ÏÈÔÚ"vim"Àï±àдԴÎļþ£»
2. È»ºóÔÙÓÃ"gcc"±àÒëÉú³É"hello"µÄ¿ÉÖ´ÐÐÎļþ£»
3. ÔËÐÐ"hello"£¬¿´¿´Ð§¹û¡£
ÄÇô¿ªÊ¼°É£¡
1. vim
vim hello.c
i
#include <stdio.h>
int
main (void)
{
printf ("hello.\n" ......
CµÄËÄÖÖ´æ´¢ÀàÏÞ¶¨·û£º
extern:Íⲿ±äÁ¿
static £º¾²Ì¬
register£º´æ´¢Æ÷
auto£º×Ô¶¯¡¡
¾²Ì¬¾Ö²¿±äÁ¿£º
´æ´¢ÇøºÍÈ«¾Ö±äÁ¿ÊÇÒ»ÑùµÄ¡£¾²Ì¬¾Ö²¿ºÍÈ«¾Ö±äÁ¿¼äµÄÖ÷ÒªÇø±ðÊÇ£º¾²Ì¬¾Ö²¿±äÁ¿½ö¶ÔËüÔÚÆäÖÐÉùÃ÷µÄ¿éÊÇ¿ÉÖªµÄ¡£
¾²Ì¬È«¾Ö±äÁ¿£º
¸æËß±àÒëÆ÷´´½¨Ò»¸ö½öÔÚÉùÃ÷ËüµÄÎļþÖпÉÖªµÄÈ«¾Ö±äÁ¿¡£ÕâÒâζ×Å£º¼´Ê¹±äÁ¿Ê ......
¶þ·Ö²éÕҵĴúÂë.
int bfind(int* a,int len,int val)
{
int m = len/2;
int l = 0;
int r = len;
while(l!=m && r!= m)
{
if(a[m] > val)
& ......