typedef statement
typedef statement helps us to give/assign a new name to an existing datatype. Further the new name can be used to declare variables.
Syntax:
typedef datatype newname;
Example:
typedef int hello;
int a,b; hello a,b;
typedef float real;
float x,y; real x,y;
typedef char hello;
char name[20]; hello name[20];
typedef char hello[20];
char name[20]; hello name;
/* typedef */ #include<stdio.h> int main() { typedef int hello; hello a,b,c; printf("Enter any no "); scanf("%d",&a); b=a*a; c=a*a*a; printf("Square = %d\n",b); printf("Cube = %d\n",c); return(0); }
/* Output */ Enter any no 5 Square = 25 Cube = 125