¡¾ÇóÖú¡¿ÓÃgcc ±àÒë³ÌÐòÔÚÃüÁîÐÐÖÐÊäÈë²»ÔËÐÐ
ÄúºÃ!Ï£ÍûµÃµ½ÄúµÄ°ïÖú:ÈçϳÌÐò:,I9DF(mK{
#include <stdio.h>a.G{(Hb*Lua3z
main()
{/v7Z-Dk5b7QF
char my_string[]="Hello World";
my_print(my_string);
my_print2(my_string);A5aKDxu+V
}
int my_print(char *string)
{ printf("The string is %s\n",string);
}
int my_print2(char *string)*@-~7AL&su?%P
{ char *string2;-I m:kOX$E4c
int size,size2,i;
size=strlen(string);
size2=size-1;
string2=(char *)malloc(size+1);
for(i=0;i<size;i++)%V1FK IYxc
string2[size2-i]=string[i];d7oEtF.|Z
string2[size]='\0';.G*Kw!U}Rk
printf("the string printed backward is %s\n",string2);FDP0l+d0J4f
}
ÓÃVI±à¼ºÃºó´æÔÚ/home/font,ÎļþÃûhello.c,ÓÃGCC±àÒë:
[font@localhost.font]$gcc -o hello hello.c
ÔÙÊäÈë
[font@localhost.font]$hello
½á¹û:a*~!]2r%n~;c+k
-bash:hello:command not found
ÇëÎÊΪʲôhello³ÌÐòÎÞ·¨ÔËÐÐ?лл! ˸æËßÄã¿ÉÒÔÕâÑùÔËÐÐÃüÁîµÄ£¿ ÈýÖÖ½â¾ö·½·¨:
(1)°ÑÄ㵱ǰµÄ¹¤×÷·¾¶Ìí¼Óµ½»·¾³±äÁ¿ÖÐ
(2)°ÑÄãµÄ±àÒëºÃµÄ³ÌÐò¸´ÖƵ½/usr/binĿ¼ÖÐ
(3)ÆäʵÔËÐÐ ./hello¾Í¿ÉÒÔÁË °Ñ .: Ìí¼Óµ½PATHÖÐ
»òÕßÖ±½Ó./hello ·¹ý£¬ÎÞÓïÁË¡£ Èç¹û¿ÉÖ´ÐÐÎļþĿ¼ÏÂÓà ./hello ¾Í¿ÉÒÔÖ´ÐÐÁË£¬./ µÄº¬ÒåÊǵ±Ç°Ä¿Â¼£¬Èç¹û²»ÊÇhelloĿ¼ÏÂÔËÐУ¬ÒªÓà ·¾¶+ÎļþÃû Ö´ÐС£ ¶Ô°¡£¬Ö±½Ó./hello£¬ÎÒ¸Õ¿ªÊ¼Ò²ÊÇÕâÑù£¬²»¹ýÊéÉÏÓ¦¸ÃÓÐдµÄ°¡£¬ºÇºÇ£¬¼ÓÓÍ
Ò³:
[1]