answersLogoWhite

0

What are the Uses of typedef?

Updated: 8/16/2019
User Avatar

Wiki User

10y ago

Best Answer

the purpose of typedef is to redefine the name of an existing variable type.

e.g.

typedef unsigned long int T;

T v1,v2;

User Avatar

Wiki User

10y ago
This answer is:
User Avatar

Add your answer:

Earn +20 pts
Q: What are the Uses of typedef?
Write your answer...
Submit
Still have questions?
magnify glass
imp
Related questions

Typedef int a a a Is this possible in C?

No, but 'typedef int a;' is possible, it defines the type 'a'.


What is the use of type def in c?

A typedef is used to define a type. The clue is in the name: typedef = type definition.


How do we represent typedef in enterprise architect tool?

create class with typedef construct.and then add the base class with the name type


How is typedef different from int in c language?

They are entirely different things; int is a type, typedef is a way to define types.


Use of typedef?

You use typedef to give a different name to a current data type. Consider the following: typedef int integer; Now everytime you do "integer x", it'll be an int. Basically, there is no case where you _must_ use it, only cases where it might be easier to have typedefs.


What is the difference between a macro and typedef?

A Macro is a preprocessor directive means that before compilation the macros are replaced. Where as typedef is defining a new data type which is same as the existing data type. Syntax: typedef Existing datatype New datatype For example typedef int NUMBER; Here NUMBER (New datatype)is defined as a data type which contains the properties same as int(Existing datatype). You can declare a variable of int as NUMBER a; is same as int a; similarly typedef int* NUMBERPOINTER; NUMBERPOINTER a; Here a is a pointer of integer type.


What is meant by the storage class of a variable?

auto, extern, static, register, typedef (only formally)


What is the difference between Typedef and Reference in C plus plus?

A typedef is a compiler macro. A reference is a pointer, usually implemented with transparent syntax. They have no relationship between each other.


What is the use of typedef?

The purpose of typedef is to assign alternative names to existing types, most often those whose standard declaration is cumbersome, potentially confusing, or likely to vary from one implementation to another


Is address a user-defined data type?

You can define a data-type called 'address': 1. typedef void *address; 2. typedef struct address { char country [32]; char state [32]; ... } address.


How do you write a c program that define a structure linesegment that will represent a line segment by the co-ordinate of its endpoint?

There will a part like this: typedef struct Point { double x, y; } Point; typedef struct LineSegment { Point from, to; } LineSegment;


How do you do union array?

typedef union U_t {/*...*/} U; U a[100]; /* an array of 100 unions */