Typedef in C

This tutorial explains typedef in c programming.

Typedef in C

Although typedef is thought of as being a storage class, it isn’t really. It allows you to introduce synonyms for types that could have been declared some other way.

The new name becomes equivalent to the type that you wanted, as this example shows.

typedef int aaa, bbb, ccc;
typedef int ar[15], arr[9][6];
typedef char c, *cp, carr[100];

/* now declare some objects */
/* all ints */
aaa int1;
bbb int2;
ccc int3;
ar yyy; /* array of 15 ints */
arr xxx; /* 9*6 array of int */
c ch; /* a char */
cp pnt; /* pointer to char */
carr chry; /* array of 100 char */


If you have any doubt feel free to comment below 🙂

You can also read the below tutorials.

Linux Device Driver TutorialsC Programming Tutorials
FreeRTOS TutorialsNuttX RTOS Tutorials
RTX RTOS TutorialsInterrupts Basics
I2C Protocol – Part 1 (Basics)I2C Protocol – Part 2 (Advanced Topics)
STM32 TutorialsLPC2148 (ARM7) Tutorials
PIC16F877A Tutorials8051 Tutorials
Unit Testing in C TutorialsESP32-IDF Tutorials
Raspberry Pi TutorialsEmbedded Interview Topics
Reset Sequence in ARM Cortex-M4BLE Basics
VIC and NVIC in ARMSPI – Serial Peripheral Interface Protocol
Bootloader Tutorials
0 0 votes
Article Rating
Subscribe
Notify of
guest

This site uses Akismet to reduce spam. Learn how your comment data is processed.

0 Comments
Inline Feedbacks
View all comments
0
Would love your thoughts, please comment.x