It is the time to start C. Hello World!
C is the most popular programming language all over the world(though I don’t totally agree with that but at least my teacher said that and it’s true that everyone who’s majored in CS of any university needs to learn it.).
This is a Hello World of C.
#include <stdio.h>;
int main()
{
printf("Hello World!\n");
return(0);
}
Let’s see what’s the meaning of each words.
#include is the head of any C script, it means that “these code below will need X library.”. It’s called Pre-Processing. the X is the one after #include, it’s “stdio.h” in the example. The library is another program which is already programed there. With the #include, it can be use in your program. Stdio.h is the one that offer input and output function, there’re a lot of different libraries there, such as math.h, fstream.h, etc.
printfis the output. It can display whatever it is inside the quotation marks, but no “\n”. “\n” means line feed.
returnis return the Function main a result, or you can say give back a number.
That is the Hello World!
To run the code, you should use cmd if u are using a Windows, or use terminal if using a Mac.
Goto the direction of where u saved ur code.
for Windows, type “bcc filename.c”, Enter, then type filename.exe to run it and see the result~
for Mac, use “gcc filename.c” in terminal, then type “./a.out” to run it.
Enjoy.



Recent Comments