typedef Statement in C with program

Using typedef statement we can create new data type in c programming language.

Syntax:-
typedef type name;

Example:-

typedef int number;

Now we can use number as datatype, lets see:-

number n = 10;

WAP in C to Convert Hours in Minute and Secound

#include<stdio.h>
#define H 60
void main()
{
typedef int hours;
hours hrs;
printf(“Enter Hours : “);
scanf(“%d”, &hrs);
printf(“\nMinutes = %d”, hrs*H);
printf(“\nSecounds = %d”, hrs*H*H);
getche();
}

 

Leave a Reply

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