【求助】用gcc 编译程序在命令行中输入不运行
您好!希望得到您的帮助:
h w+ph E#zs如下程序:
7L~
QG'p9\St#include <stdio.h>Linux伊甸园论坛)x'P
|7Dd-O7_
main()
?U8TO?7z/XQ A*@qd{
2pK9V6~3| char my_string[]="Hello World";
.igk
\.K| my_print(my_string);
"C~FS4gHbLinux伊甸园论坛 my_print2(my_string);Linux伊甸园论坛X.^{:q{
? ] H
}
'G-Tv8\B0q9Pint my_print(char *string)
8sn8eK [Il{ printf("The string is %s\n",string);Linux伊甸园论坛:WlNA-X`/J'}G7h
}!R
i"i]&iW
int my_print2(char *string)Nl+m?$xbEn`
{ char *string2;
x*c
zMh*Lint size,size2,i;t"a6?8_C B
size=strlen(string);+_v)r;xP;H.C+d
size2=size-1;j2^
Co)~yPI
string2=(char *)malloc(size+1);o{;b1ewFT"x0t
for(i=0;i<size;i++)
/M,PT
M'~x
jstring2[size2-i]=string;
$we-_
aMk]string2[size]='\0';Linux伊甸园论坛u%l;C3zV9\R
printf("the string printed backward is %s\n",string2);/\$]c;ij0[
}
|/a1R-L `?用VI编辑好后存在/home/font,文件名hello.c,用GCC编译:www.linuxeden.com:Sb0h5t]3M
w(_
[font@localhost.font]$gcc -o hello hello.c
P%c kU8V`FT{bLinux伊甸园论坛再输入
R i*DB
ZuQHLinux伊甸园论坛[font@localhost.font]$hello
GL2Fi
AaC!dx d&i结果:yq1]B{#e-u^E
-bash:hello:command not found
"o)hQ6FJ)aJLinux伊甸园论坛请问为什么hello程序无法运行?谢谢!
|