I want to learn how to write a C program under Linux. Now I have installed Centos, and I'm using vim
to write a 'hello world' program in the C language. But I don't know where to put it, or how to compile it? I have installed gcc
. I am sorry. I am a newbie. Thank you. Could you make me an example how to write a simple program in C then test and compile it.?
相关问题
- Multiple sockets for clients to connect to
- Is shmid returned by shmget() unique across proces
- What is the best way to do a search in a large fil
- glDrawElements only draws half a quad
- how to get running process information in java?
type this in your terminal:
Save it anywhere, then in a terminal run
gcc path/to/file.c
That's all it takes. The default output will be a file called
a.out
which you can run directly from the terminal.If you're uncomfortable with the terminal (though since you're using vim I'll assume you're not), there are many IDEs that make it even easier for beginners.