The first steps with the C language

  • 4
    Shares

 

 

C Language

 

Today we will talk about a simple program in C language, then open eclipses and start a new project.

 

The first lines of code will be dedicated to the inclusions of the libraries that I will explain later. For the moment insert the written:

 

  • #include<stdlib.h>
  • #include <stdio.h>

 

You must know that any code you want to write, you write in a function called main, later I will talk about this function, but also about other functions.

 

For now it is better not to complicate your life.

 

Then type int main () {} and you have to write the code inside the braces.

 

At the end of the main function, before the brace that closes everything, you are “obligated” to write (forced NO, but it is my very useful advice)

 

  • system(“pause”);
  • return 0;

 

C Language

 

Now we will make the first simple program that will display a writing like ‘hello world’.

 

So under the main you will have to write printf (“hello world”);

 

after the word printf (“you can write anything you want”);

 

Then you have to save by clicking on the central icon at the top

 

C Language

 

After saving you have to fill in the code by clicking on the hammer

 

C Language

 

Now go to the left and select the name of your project, click on binaries.

 

Under binaries there will be the name of your project.exe, right click and select ‘open With’ and then ‘system editor’.

 

C Language

 

And so you will start your first program.

 

Next time we will do something a little more complex, but first I will have to explain a little theory to apply.

 

Stay Tuned!


  • 4
    Shares

SviluppoMania - Piko

Salve, sono un ragazzo di 25 anni, iscritto alla facoltà di informatica, appassionato di programmazione e delle nuove news tecnologiche in ambito informatico.

Leave a Reply

This site uses Akismet to reduce spam. Learn how your comment data is processed.

"GDPR" Data Request Form

Select your request: