![]() |
The C programming language, developed in the early 1970s by Dennis Ritchie at Bell Labs, quickly gained popularity due to its efficiency, portability, and flexibility. However, C variations and extensions by different compiler vendors led to compatibility issues. To address this, the American National Standards Institute (ANSI) formed a committee, X3J11, in 1983 to standardize the language and the standard that came out was ANSI C In this article, we will explore the different features adopted in ANSI C along with the deprecated features. We will also look at the compiler that provides full support to this standard. What is ANSI C?ANSI C also referred to as C89, was the first C Programming Language Standard defined by the American National Standards Institute (ANSI) in 1989. It is officially designated as ANSI X3.159-1989. By standardizing the language for use across compilers and platforms, it represents a major landmark in the evolution of C. ANSI C standard was designed to offer consistent and reliable programming environment that can produce code which works with minimal adjustments on different systems. The standard was later adopted by the International Organization for Standardization (ISO) as ISO/IEC 9899:1990, often referred to as C90. Added Features of the ANSI C StandardThe ANSI C Standard adopted the main features of the language along with the features popular at that time from the given compilers. Important features include: 1. Function PrototypesFunction declarations now include the types of their parameters, enabling the compiler to perform type checking. int add(int a, int b); // Function prototype
2. Standard LibraryThe C standard library of ANSI included a comprehensive set of functions for input/output operations, string manipulation, memory allocation and more, these standardized set of functions made it easier to write portable code. Libraries are written in the form of header files like: #include <stdio.h>
#include <stdlib.h>
There are total of 24 header files in ANSI Standard 3. New Data TypesANSI C also introduced the popular and useful data types that were not the part of every compiler version of C. They are
4. Type QualifiersThe const and volatile qualifiers were added for variables. Prior to the introduction of type qualifiers such as const and volatile, a better regulation was needed for variable modification as well as optimization. 5. Structure AssignmentDirect assignment of structures was allowed. It means that we could assign the structure to another structure just like variables. Example struct Point {
int x, y;
};
struct Point p1 = {0, 1};
struct Point p2 = p1; // Structure assignment
6. Standardized Predefined MacrosMacros like __FILE__, __LINE__, and __DATE__ were standardized. 7. Formatted Input/OutputEnhanced support for formatted input/output through functions like printf and scanf and more like sscanf, fprintf, etc. 8. Dynamic Memory AllocationFunctions were standardized for dynamic memory management. They included:
int *ptr = (int *)malloc(sizeof(int) * 10);
9. Improved Compatibility and PortabilityThe standard provided guidelines to ensure consistent behaviour across different platforms and compilers. Deprecated Features in ANSI C StandardBecause the ANSI C had a number of additions, certain features in earlier versions were deprecated or removed so as to make it uniform and more portable: 1. Implicit Function DeclarationsTo improve type checking and to avoid errors that might occur and functions that are called without prior declaration or definition are no longer allowed. 2. K&R Function DefinitionsDescription: Traditional K&R (Kernighan and Ritchie) style function definitions without type information are now obsolete and replaced by new function prototype syntax. Example (deprecated): // Deprecated K&R style
int add(a, b)
int a, b;
{
return a + b;
}
Example (new style) int add(int a, int b) { 3. Non-Standard Keywords and ExtensionsTo enhance its portability and compliance with the standard, non-standard keywords and compiler-specific extensions that were not part of original C language have been abolished. Compiler Support for ANSI C/C89Many compilers added support for ANSI C/C89 to ensure compliance with the new standard. Some of the notable compilers that supported ANSI C/C89 include:
ConclusionThe introduction of ANSI C/C89 was a critical development in the history of programming languages. By adding new features, standardizing the language, and ensuring wide compiler support, ANSI C/C89 established a solid foundation for writing portable, reliable, and maintainable code. Its influence persists today, as many of the features and conventions introduced in ANSI C continue to shape modern programming practices. |
Reffered: https://www.geeksforgeeks.org
C Language |
Related |
---|
![]() |
![]() |
|
![]() |
![]() |
Type: | Geek |
Category: | Coding |
Sub Category: | Tutorial |
Uploaded by: | Admin |
Views: | 79 |