| Credits: bioinfohub.com |
Why not you start to learn this language from the scratch and know the absolute beauty of it, so let's say Hello to C.
Note that: Many things will not be mentioned in this article, for a very good reason to not confuse you right now.
Install your editor and compiler. We suggest you to download Dev C++. After you are done installing this compiler and are good to go, we shall now dive into the sea, get it? 'C'. This C editor is smart and completes your statements and closes your brackets when you open them.
1) We first need to include the header file like this:
#include <stdio.h>
|
2) Then open the main body like this, it it the body where every important thing is coded and every output is gathered. Open up the main body like this:
int main(){ |
3) We now will say Hello to the screen, to do that write this:
printf("Hello World!");
|
4) Now write this, don't worry about this step just remember for now that it is a necessary step:
return 0; } |
Press F11 to compile and run your program. You just became a programmer, congratulations! Now we'll do something more fancy. We'll now display a number on the same console display screen. To do that, repeat the first two steps. Then we need to tell that computer what type of number we wanna save into the memory. Let's define a number '2' which is an integer number. In C, we write int for integer.
3) The step would be where we save '2' in an int variable we named it as number:
int number = 2; |
4) Get the output like this where %d is a necessary statement to write in double inverted commas:
printf("%d", number);
|
5) Press F11 and enjoy!
We want you to practice and keep on practicing these steps and we hope that you have understood all the steps we mentioned in this article. Give us your feedback by clicking here or comment down below. Thanks for reading!
Assignments:
You have an assignment! Download this document and solve the questions for your practice. Send us your solution .c or .cpp files through The QuickSEnd down below.
The QuickSEnd:
No comments:
Post a Comment