basic in c programming

Introducing the basic in C programming

Basic for C programming

C  is a general-purpose programming language, which was designed by Dennis Ritchie. C  is not a very high-level language, so it will be little difficult to understand, when compared with a high-level language like python, if you are planning to learn C++, C#, and Java then it will be better to start with C because C++, C#, and Java are based on C.

Why  C  is called a system programming language?

C is called a system programming language because it is useful for writing compilers and operating system’s

What are subroutines in C?

C  functions are called subroutines.

Structure of a c program

Statement 1;
Function 1 ()
Statement 1;
Function 2()
Function N()
Statement 1;

Variables and constants         

Variable is a box which stores the values and it would always better to use meaningful names so that you can reduce confusion in the code with names. Variables should be declared before we use in C

Numeric  variables

The numeric  variables which we can use in C are

(1) Integer values

(2) Floating point values

In C, we can use four modifiers

 With numeric  variables, we can also use this four modifiers

Character  variables  

(a, A ,b,B) :   Alphabets

(0,1,2,3,4):    numbers

(#,!,&,@):     special symbols

Declaring variables                                                        initializing variables

Int  student_num;                                                           student_num =24;

Float marks;                                                                     marks =97;

Char name;                                                                       name = Tom;

Note:  variables has to be declared before use

Constant variable: constant is variable whose values does not change, which are used for fixed values such as pi=3.14;

Writing a simple C program

What are literals and identifiers in a programming language?

In programming language constants are called literals and variables are called identifiers, also constant is box whose values are fixed, while the variable is a box whose values can be changed.

Input and output function

Scanf () function receives input values while printf() function print output values on the screen

Syntax of a printf() function

Printf(“<format string>”,<no of  variables>);

<format string> contain

 Int uses %d

Float uses %f

Char uses %c

Character string uses %s


Printf(“%d”, x);


We use scanf() in order to receive input values from user



Scanf(“%f%f%d”, x,y,z);

Note: the difference between printf() and scanf() function is that we use address operator (&) before variable in scanf()

What is a  main()  in c program?

It is a function, which you can consider as a vessel with a set of statements in it.

Int main()






The data type int kept before main() because the function will return an integer number also due to the fact that,  the main() function always return an integer number.

How to comment in a c program?

Comments in a c program must be enclosed within asterisk(*)

/* this is a comment*/

Mohammed Anees

Hey there, welcome to aneescraftsmanship I’m Mohammed Anees an independent developer/blogger.

Leave a Reply

Your email address will not be published.