C (pronounced "See", like the letter C) is a general-purpose computer programming language developed between 1969 and 1973 by Dennis Ritchie at the Bell Telephone Laboratories for use with the UNIX operating system. Its design provides constructs that map efficiently to typical machine instructions, and therefore it found lasting use in applications that had formerly been coded in assembly language. It is a highly efficient procedural oriented programming language, has emphasis on functions whereas modern object oriented programming languages tend to emphasize data.
Although C was designed for implementing system software, it is also widely used for developing portable application software.
C is one of the most widely used programming languages of all time and there are very few computer architectures for which a C compiler does not exist. C has greatly influenced many other popular programming languages, most notably c++, which began as an extension to C.
##Design C is an imperative (procedural) systems implementation language. It was designed to be compiled using a relatively straightforward compiler, to provide low-level access to memory, to provide language constructs that map efficiently to machine instructions, and to require minimal run-time support. C was therefore useful for many applications that had formerly been coded in assembly language.
Despite its low-level capabilities, the language was designed to encourage cross-platform programming. A standards-compliant and portably written C program can be compiled for a very wide variety of computer platforms and operating systems with few changes to its source code. The language has become available on a very wide range of platforms, from embedded micro-controllers to supercomputers.
##Before you start
Please browse our list of frequently asked questions and the following list to see if your question is similar to one of the following:
- i++ + ++i and similar questions. Why are these constructs undefined behavior?
- Why isn’t sizeof for a struct equal to the sum of sizeof of each member?
- What is the strict aliasing rule?
- Absolute Beginner’s Guide to Bit Shifting
- Why does the linker fail with undefined symbols?
- Passing multi-dimensional arrays as function arguments
- Where can I find the C or C++ standard documents?
- Why is one loop so much slower than two loops?
- How do you set, clear and toggle a single bit in C/C++?
- Do I cast the result of malloc?
If you haven't found an answer to your question after searching, or in the list above, we're here to help!
When posting questions about C programming, please make sure to include:
- Target system & compiler version
- Add kr-c, c90, c99 or c11 in case your question is specific to one particular version of the standard (more info).
- Unless the question does not explicitly mention which version of the C standard that is used, it is assumed that the current version is used. That is, whichever version of ISO 9899 that ISO currently lists as active. Please have this in mind when answering/commenting questions tagged c.
- Relevant flags / switches passed to the compiler, assembler or linker if applicable
- Verbatim copies of compiler warnings or errors if applicable
- Snippets of source code identified as problematic by the compiler if applicable
###Is it C, C++ or both?
This tag is for questions related to C, not C++. In some cases, you may be working with both and applying both tags is entirely appropriate. However, please refrain from using both tags in an effort to help your question reach a wider audience. After all, C++ answers won't help you solve the problem in C, and good C answers often do not describe the best approach in C++.
###Important notes that may save you time
- The comp.lang.c FAQ has answers to many frequently asked C questions. For example, see The Clockwise/Spiral Rule for parsing C declarations.
- cdecl: C gibberish ↔ English, a site that translate C expressions to readable English.
- What Every Computer Scientist Should Know About Floating-Point Arithmetic, by David Goldberg
Hello World program in C
#include <stdio.h>
int main (void) {
printf("hello, world\n");
return 0; /* This line is implicit since C99, but only for main */
}
Definitive Book Guide
The Definitive C Book Guide and List has been compiled by c users as a definitive list of quality references for all levels of C programmer. If you're looking to learn or improve your C, you may find it helpful.
Chat Room
Chat about C with other Stack Overflow users