To start using C, you need two things:
There are many text editors and compilers to choose from. In this tutorial, we will use an IDE (see below).
myfirstprogram.c
#include <stdio.h>
int main() {
printf("Hello World!");
return 0;
}
Don't worry if you don't understand the code above - we will discuss it in detail in later chapters. For now, focus on how to run the code.
In Codeblocks, it should look like this:
Then, go to Build > Build and Run to run (execute) the program. The result will look something to this:
Hello World!
Process returned 0 (0x0) execution time : 0.011 s
Press any key to continue.
Congratulations! You have now written and executed your first C program.
When learning C, you can use our "Try it Yourself" tool, which shows both the code and the result. This will make it easier for you to understand every part as we move forward:
myfirstprogram.c
Code:
#include <stdio.h>
int main() {
printf("Hello World!");
return 0;
}
Result:
Hello World!
10 videos|13 docs|15 tests
|
1. What is the purpose of the C programming language? |
2. How do I get started with C programming? |
3. Can I learn C programming without any prior programming experience? |
4. What are the advantages of learning C programming? |
5. Are there any resources available for practicing C programming? |
|
Explore Courses for Class 6 exam
|