Disadvantages of Structures in C
In C programming, structure is a collection of different data items which are referenced by single name. It is also known as user-defined data-type in C.
Using structure in C language has several benefits as well as drawbacks. In this article we are going to list key drawbacks or disadvantages of structure while using it in C.
- Can increase complexity of the program: excessive use of structures in C increases complexity of program and program becomes difficult to manage.
- Slower: excessive use of structures makes programs slower due to storage overhead required for all data.
- Hard to manage: change in one structure variable forces change in many places in the program which makes programmer difficult to maintain and debug if there is excessive use of structure and pointer.
- Difficult error tracking: excessive use of structures in C increases complexity thereby making it difficult for error tracking.
- A steep learning curve: beginners find it difficult to use structure in C thereby making a slow learning curve.
- Page faults: using a lot of pointer dereferences can be a performance hit in structure due to additional memory fetch and locality of references, which may lead to page faults.