我的第一个c程序

很惭愧,到现在才写自己的第一个c程序!以前服务器做的管理都是用shell来管理,和都是在一直写php 的web程序!一直觉得c都是深不可测,今天决定学习一下c!一下是第一c:helloword

1.编写程序:
vi firstc.c


#include "stdio.h"
int main(){
printf('hello word');
}


保存后编译
gcc -o firstc -g first.c


-o 编译后的文件名
-g 编译文件名
:D 暂时只知道这些

编译后出错:
firstc.c:3:9: warning: character constant too long for its type
firstc.c: In function 'main':
firstc.c:3: warning: passing argument 1 of 'printf' makes pointer from integer without a cast


貌似是单引号的问题 ,改成双引号

再编译就好了!

运行:
./firstc


结果:


[code="linux"]# ./firstc
hello word# [/code]

哈哈
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值