C Programming Language || Introduction to C || Bcis Notes

 C Programming Language

C is a programming language developed by Dennis Ritchie at the bell laboratories in the mid-1970s. A c programming language is a high-level language, which seems popular because C programming language is reliable, simple and easy to use. It is designed to have both, good programming efficiency and good machine efficiency.

Advantages of C Programming

  • It is easy to learn.
  • It is portable, we can easily transfer a program written in C from one computer to another computer.
  • It is a faster and efficient programming language than other high levels ( 4GL ) languages.
  • Supports structured programming, which means the problem might be solved in terms of functions modules or blocks.
  • Adding new features is easy and faster.
  • It is relatively near to the low-level language, hence it is easier to interact with hardware.

Disadvantages of C Programming

  • The programs take more time to design, implement to the software.
  • C coding techniques sometimes result in repeating code in time.
  • C does not have an efficient garbage collection.
  • It doesn’t contain run-time checking.
  • It does not support object-oriented programming(OOP) features, so to overcome C++ language was introduced.

Structure of C program

1. Preprocessor
This is a part of the compiler which performs preliminary operations (conditionally compiling code, including files, etc).

2. Comment
It is the extra information that is not a part of a real program.

3. Function
It is a basic block of the program.

<stdio.h> = standard input output header file

4. Statements/Expression
A statement is a command given to the computer that instructs the computer to take a specific action, such as a display to the screen, or collect input. A computer program is made up of a series of statements.

5. Variables
Variables are the name which can hold different data.

# Parameter
The term parameter refers to any declaration within the parentheses following the function name in a function declaration or definition; the term argument refers to any expression within the parentheses of a function call.

# Data Type
A data type is an instruction that is used to declare the category or type of variables being used in the program. There are 5 types of data.
String
Integer 
Float
Character
Void

String
A  C-string is a character sequence stored as a one-dimensional character array and terminated with a null character.
Example:

strcpy(str1, str2);

Integer
The integer data type only supports integer numbers. It does not support decimal numbers and functionals numbers. it consumes 2 bytes of a memory location.
Example:

int a=5;

Float 
The float data type supports integer numbers as well as it supports decimal and functional numbers. it consumes 4 bytes of a memory location.
Example:

float a=5.6;

Character
The character data only supports the character. it consumes 2 bytes of a memory location.
Example:

char ‘a’;

Void
A void is the data types that have no value. It is used as written types for functions that do not return a value.
Example:

void main()

Simple Example of C Programming

#include<stdio.h>
void main()
{

printf(“HELLO WORLD);

}

 

you may also like Operator, Header File 

Be the first to comment

Leave a Reply

Your email address will not be published.


*