Learn C Language 

Learn C Programming Language Step By Step. It’s easy to learn c programming language with real-life examples and hands-on. We are trying our best to deliver quality content.

TypeDef In C 

« Previous Page                                                                                                                     Next Page »

Typedef is a keyword in C language, which you can use to give a type a new name. Following is an example to define a term BYTE for one-byte numbers

After this type definition, the identifier BYTE can be used as an abbreviation for the type unsigned char, for example.

By convention, uppercase letters are used for these definitions to remind the user that the type name is really a symbolic abbreviation, but you can use lowercase, as follows −

You can use typedef to give a name to your user defined data types as well. For example, you can use typedef with structure to define a new data type and then use that data type to define structure variables directly as follows

When the above code is compiled and executed, it produces the following result 

typedef vs #define

#define is a C-directive which is also used to define the aliases for various data types similar to typedef but with the following differences −

  • typedef is limited to giving symbolic names to types only where as #define can be used to define alias for values as well, q., you can define 1 as ONE etc.

  • typedef interpretation is performed by the compiler whereas #define statements are processed by the pre-processor.

The following example shows how to use #define in a program

When the above code is compiled and executed, it produces the following result −

Top Book Suggestion

The two books on C Programming Language that I Personally Recommend. I really loved reading these books. These books are listed for quality content, easy steps, and affordable price. You can get it from Amazon and Flipkart. 

 

Check The Price On Amazon:

1. C Programming Beginner’s Guide

2. Head First C: A Brain-Friendly Guide

Check The Price On Flipkart:

1. Introduction to C Programming 

2. Head First C: A Brain-Friendly Guide

« Previous Page                                                                                                                     Next Page »

Buy Premium Courses At Lowest Price. Become A Certified Developer Today!

Best Books Selected by Our Experts

Buy Premium Projects At Lowest Price

Ebooks Written by Our Experts

CoursePot.Com

Buy Premium Courses At Lowest Price. Grab Golden Opportunity To Become A Certified Developer Today!

Useful Links

Pin It on Pinterest

Share This