History and Basics of C programming

Electrical and Electronic Concepts

Popular Post

Rotor of Squirrel Cage Induction Motor

Monday, January 28, 2019

History and Basics of C programming

No comments
C is a very useful and widely used programming language all over the world. It is basically the first programming language which gets so much attention and used by many of the programmers from the starting. It gets is the name 'C' because two programming language ie 'A' and 'B' has been developed before its launch, it is the modified version of both these languages, 'C' was developed by
Dennis M. Ritchie in 1972 and first implemented on DEC PDP-11 computer to develop the UNIX operating system.


   
                                                                 Dennis M.Ritchie


                                                     
Many of you were thinking what is a programming language?
A programming language is a set of commands to instruct the computer to perform a task. The commands are known as 'code', these codes are then converted into the machine language by the compiler. A compiler is application software which converts the high-level language into a low-level /machine language.

Header file
A header file is a file with extension .h which is used to define the functions that are already stored in the preprocessor file. We don't have to write the whole code to execute that function, we can execute that function by writing the header file at the top.
For ex: #include <stdio.h> (standard input/output) is responsible for taking input by the user and output at the screen.
#include <stdlib>(standard library) is responsible for function which involving memory location,process control and conversion.

Main()
Whenever we compile the program your compiler search for the "main()" function which is the entry of every programming code. int is used before the main function which tells the datatype and at the end, we end with the return0 which is the termination of the program.

Printf & Scanf
Printf is the function in stdlib to display the output in the screen. To print a number we need a
 place holder(%d) which is in quotation mark which stores the output.
For example printf("%d", integer); we need to place a semicolon at the end of the line. The compiler reads the  ";" semicolon as the line terminator.
For printing Decimal, we use "f" in place of "d" with the percentage sign and "s".to add the text.

If you want to add multiple integers, place multiple place holder.
printf("%d  %d  %d",32,56,98);

Scanf is used to take the input from the user.
scanf("%d". &number);
& is used as a simple way to pass the pointer to the store value.

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

int main()
{
printf("hello world");
return 0;
}

this is the first c program to print' hello world'.




If you any doubt comment in the comment section.
Follow my insta page:
https://www.instagram.com/elec.tricknowledge/?hl=en
subscribe for more article on c and other technical knowledge.







No comments :

Post a Comment