Header Files & Type Conversion

 


Header Files:

A header file with extensions .h which contains C function declaration and macro definitions to be shared between several source files.
    Both the user and the system header files are included using the preprocessing directive #include.

Syntax:
#include<header file>
Example:
#include<stdio.h>

Type Conversion:

Type Casting:

            Type casting is a way of converting a variable from one data type to another data type.
 For example:if you want a store long value into a simpler integer then you can convert the values from one type to another using cast operator.It is also known as explicit type conversion.

Example;

#include<stdio.h>
int main()
{
int sum=17,count=5;
double mean;
mean=(double)sum/count;
printf("Value of mean %f\n",mean)
}

Automatic type conversion:

It is a type of conversion performed by the compiler without programmes intervention. An implicit conversion is applied whenever different data types intermixed in an impression so as to not to loose information also known as implicit type conversion.

for example:

int a=10;
float b;
b=a;

Post a Comment

0 Comments