A file with .c extension is a source code file for writing software applications in C programming language. C files include all the implementation of application’s functionality in the form of source code. The declaration of the source code is written in the header files that are saved with .h extension. C++ is the modern form of C language and is used to develop most of the software nowadays. C files can be opened with applications such as Notepad++, Eclipse IDE, Microsoft Visual Studio, and Borland C++ Builder.
C language came into being as a result of creating different utilities for UNIX operating system. Denis Ritchie, the man behind the creation of this programming language, the work originally started in 1960s and early 1970s.
C File Format
C files are written in plain text file format following the programming language syntax. A typical C file will have:
import statement at the top of the file to import any header Files
one or more methods to implement desired functionality
The header files, with .h extension, contain necessary include statements for including other functionality files in the project. In addition, these contain the declarations of methods defined in the implementation file. Header files are included using the include statement as shown below.
Source Code Implementation
The actual implementation of the functional requirements are coded as methods in the C file. Each method in a C file has a return type, method name and may have some input parameters. If the return type is not void, the method may be returning some value.
C Source Code Example
/* int */ other_function();
/* int */ calling_function()
register /* int */ test2;
test1 = some_function();
if (test1 > 0)
test2 = 0;
test2 = other_function();