Difference between revisions of "C"
(Detailed explanation of the language) |
|||
| (One intermediate revision by one other user not shown) | |||
| Line 1: | Line 1: | ||
The C programming language is a high-level programming language. C is a staple in application development, along with its successors C++ and C#. The C language is considered one of the fastest programming languages. C files end in .c, but there are some custom files that use a different ending. | The C programming language is a high-level programming language. C is a staple in application development, along with its successors C++ and C#. The C language is considered one of the fastest programming languages. C files end in .c, but there are some custom files that use a different ending. | ||
| + | |||
| + | __TOC__ | ||
| + | |||
| + | == Overview == | ||
| + | C is a very powerful language that can do a lot. In this introduction, we will go over how to make your program, how to run it, and where to learn more. | ||
| + | |||
| + | == Your first program == | ||
| + | Using any text editor, create a new file called "main.c". Inside, paste the following code: | ||
| + | <pre> | ||
| + | #include <stdio.h> | ||
| + | |||
| + | int main() { | ||
| + | printf("Hello, World!\n"); | ||
| + | return 0; | ||
| + | } | ||
| + | </pre> | ||
| + | STDIO.h is sort of like a hidden file. It stands for STandarD Input Output. | ||
| + | |||
| + | == C compilation == | ||
| + | === MacOS === | ||
| + | On MacOS, the C compiler comes pre-installed on the terminal. Depending on your version, you can use the command | ||
| + | <pre> | ||
| + | gcc -o main main.c | ||
| + | </pre> | ||
| + | or | ||
| + | <pre> | ||
| + | clang -o main main.c | ||
| + | </pre> | ||
| + | Run it by typing in ./main | ||
| + | === Other === | ||
| + | There is no official C compiler to use. Instead, you must download one from GNU or a similar source. There is also a C extension in VS Code Desktop. | ||
| + | |||
| + | == Learning more == | ||
| + | Many websites such as Learn C and W3Schools offer C courses that are easy to follow. | ||
{{stub}} | {{stub}} | ||
[[Category:Computer programming]] | [[Category:Computer programming]] | ||
| − | |||
| − | |||
Latest revision as of 15:41, 19 May 2025
The C programming language is a high-level programming language. C is a staple in application development, along with its successors C++ and C#. The C language is considered one of the fastest programming languages. C files end in .c, but there are some custom files that use a different ending.
Overview
C is a very powerful language that can do a lot. In this introduction, we will go over how to make your program, how to run it, and where to learn more.
Your first program
Using any text editor, create a new file called "main.c". Inside, paste the following code:
#include <stdio.h>
int main() {
printf("Hello, World!\n");
return 0;
}
STDIO.h is sort of like a hidden file. It stands for STandarD Input Output.
C compilation
MacOS
On MacOS, the C compiler comes pre-installed on the terminal. Depending on your version, you can use the command
gcc -o main main.c
or
clang -o main main.c
Run it by typing in ./main
Other
There is no official C compiler to use. Instead, you must download one from GNU or a similar source. There is also a C extension in VS Code Desktop.
Learning more
Many websites such as Learn C and W3Schools offer C courses that are easy to follow.
This article is a stub. Help us out by expanding it.