ProgrammingThis forum is for all programming questions.
The question does not have to be directly related to Linux and any language is fair game.
Notices
Welcome to LinuxQuestions.org, a friendly and active Linux Community.
You are currently viewing LQ as a guest. By joining our community you will have the ability to post topics, receive our newsletter, use the advanced search, subscribe to threads and access many other special features. Registration is quick, simple and absolutely free. Join our community today!
Note that registered members see fewer ads, and ContentLink is completely disabled once you log in.
If you have any problems with the registration process or your account login, please contact us. If you need to reset your password, click here.
Having a problem logging in? Please visit this page to clear all LQ-related cookies.
Get a virtual cloud desktop with the Linux distro that you want in less than five minutes with Shells! With over 10 pre-installed distros to choose from, the worry-free installation life is here! Whether you are a digital nomad or just looking for flexibility, Shells can put your Linux machine on the device that you want to use.
Exclusive for LQ members, get up to 45% off per month. Click here for more info.
Use g++ on the command line for Standard C++ and gcc on the command line for Standard C console applications. Most books you buy on C and C++ will focus on the console. When you want to later build GUI applications than you can use Widget libraries such as GTK+ or QT. Or you can even use Java Middleware on Linux < http://members.shaw.ca/trollking >.
Learning C is easy.
Every programmer starts programming with this program.
The program is very simple. Just to print a line.
#include <stdio.h>
int main()
{
printf("Hello, world\n");
return 0;
}
Type it out in any text editor and save it as any file name with extension ".c" say, "first.c".
At the command prompt, type
gcc first.c -o first
This will compile your program and produce the executable file called "first".
Then type
./first
to run the program. You will see the output "Hello, world" printed in the terminal.
There are a lot of resources on the C programming. You just search
"Linux C Programming" in google and you will get tons of results. Just browse through and pick a longer and complete guide you feel confortable with it. If you want solid hard copy, just print it out chapter by chapter. I think you don't even need to buy a book to start C programming. So many resources and ebooks on the net.
Last edited by moeminhtun; 02-20-2003 at 09:31 PM.
Originally posted by acid_kewpie no, it means you copied your first c program!
[ Please encourage the newbies. ]
Yeah! You wrote your first C program!.
This is the starting point. Every C programs are base on this. You might want to browse through the net, find a tutorial and try to understand it. It's pretty easy.
LinuxQuestions.org is looking for people interested in writing
Editorials, Articles, Reviews, and more. If you'd like to contribute
content, let us know.