c programming

C Tutorial -2: Environment and Syntax

Spread the love

C tutorial continues with some theoretical brief in a much simple language:

Environment :

It is much needed to download the C software on your system, or you can practice on any of the online tools available in the market. Make sure you have downloaded the C software so that you can practice as the tutorial goes on.
you can also take help from the below link to download the C software.
Download C from Softonic
Download C from apponic

The setup downloads the compiler which is responsible to convert higher-level to lower-level language and vice versa.

Compiler :
A compiler is a software that will convert the machine code to human understanding code. Whenever we write any program then the compiler runs our source code written in the source file which is readable by humans and then converts it to a machine language thereby facilitating to ease us in building software and saving much time.

Tokens:
Tokens are various components of C which when combined performs a specific function.
Example:
)
printf
scanf
#
?
(

Identifiers:
Identifiers are the name given to any variable, function, class or any user-defined types. Its a case sensitive which means it understands uppercase and lowercase and so to make it work we need to be careful while writings any statements or function.
Example: a, b, ab, _ab, Ab ,a0
** here ab and Ab are two different identifiers

Keywords:
The special words which are predefined by the software kept as reserves which can not be used as variables or any other type.
example:
break
continue
if
else
for
int …..etc

Comments:
These are the special symbol “//”, /* */which is being used with the statement giving information about the flow, algorithm, or any part of developing. The statement does not take part in any internal flow but just provide a piece of information to the developers or users.
** We have two types of comments in C

  1. Single-Line Comments: //
  2. Multi-Line Comments : /* *?

Example :

  1. void main() // main function
  2. int a = 0; //initialization
  3. if(a > 5); //condition
  4. printf(a); /*To print the statement
    by displaying the value of a */

In order to start making a simple C Program lets take a look at some of the components used within it:
Header: we need to include

SemiColon:
To terminate each statement we use a semicolon ;
int a ; int b ; int c;
the above statement is the same like
int a ;
int b ;
int c;

Whitespace:
The compiler won’t access the blank space left between any keywords, variables. The blank spaces used as string i.e within the quotes is only accessed.
But ensure a minimum of a single space between two keywords, or keywords and constant.

int<whitespace>a;
which means
int a;
Similarly other examples of it are:
string b = “tenoclocks”;
float a = 8.0;

** Will discuss in detail with the use of all under-sample program in the next C tutorial / C programming tutorial
Learn C# in a much easier way

Leave a Reply

Your email address will not be published. Required fields are marked *