c (programming language) c programming language redirects here for the book see the c programming language c si as in the letter c is a generalpurpose imperative computer programming language supporting structured programming lexical variable scope and recursion while a static type system prevents many unintended operations by design c provides constructs that map efficiently to typical machine instructions and therefore it has found lasting use in applications that had formerly been coded in assembly language including operating systems as well as various application software for computers ranging from supercomputers to embedded systems c was originally developed by dennis ritchie between 1969 and 1973 at bell labs with c compilers from various vendors available for the majority of existing computer architectures and operating systems c has been standardized by the american national standards institute ansi since 1989 see ansi c and subsequently by the international organization for standardization iso c is an imperative procedural language it was designed to be compiled using a relatively straightforward compiler to provide lowlevel access to memory to provide language constructs that map efficiently to machine instructions and to require minimal runtime support despite its lowlevel capabilities the language was designed to encourage crossplatform programming a standardscompliant c program that is written with portability in mind 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 microcontrollers to supercomputers overview dennis ritchie right the inventor of the c programming language with ken thompson like most imperative languages in the algol tradition c has facilities for structured programming and allows lexical variable scope and recursion while a static type system prevents many unintended operations in c all executable code is contained within subroutines which are called functions although not in the strict sense of functional programming function parameters are always passed by value passbyreference is simulated in c by explicitly passing pointer values c program source text is freeformat using the semicolon as a statement terminator and curly braces for grouping blocks of statements the c language also exhibits the following characteristics there is a small fixed number of keywords including a full set of control flow primitives for ifelse while switch and dowhile userdefined names are not distinguished from keywords by any kind of sigil there are a large number of arithmetical and logical operators such as etc more than one assignment may be performed in a single statement function return values can be ignored when not needed typing is static but weakly enforced all data has a type but implicit conversions may be performed declaration syntax mimics usage context c has no define keyword instead a statement beginning with the name of a type is taken as a declaration there is no function keyword instead a function is indicated by the parentheses of an argument list userdefined typedef and compound types are possible heterogeneous aggregate data types struct allow related data elements to be accessed and assigned as a unit union is a structure with overlapping members only the last member stored is valid array indexing is a secondary notation defined in terms of pointer arithmetic unlike structs arrays are not firstclass objects they cannot be assigned or compared using single builtin operators there is no array keyword in use or definition instead square brackets indicate arrays syntactically for example month enumerated types are possible with the enum keyword they are freely interconvertible with integers strings are not a separate data type but are conventionally implemented as nullterminated arrays of characters lowlevel access to computer memory is possible by converting machine addresses to typed pointers procedures subroutines not returning values are a special case of function with an untyped return type void functions may not be defined within the lexical scope of other functions function and data pointers permit ad hoc runtime polymorphism a preprocessor performs macro definition source code file inclusion and conditional compilation there is a basic form of modularity files can be compiled separately and linked together with control over which functions and data objects are visible to other files via static and extern attributes complex functionality such as io string manipulation and mathematical functions are consistently delegated to library routines while c does not include some features found in some other languages such as object orientation or garbage collection such features can be implemented or emulated in c often by way of external libraries eg the boehm garbage collector or the glib object system relations to other languages many later languages have borrowed directly or indirectly from c including c c unixs c shell d go java javascript limbo lpc objectivec perl php python rust swift verilog and systemverilog hardware description languages these languages have drawn many of their control structures and other basic features from c most of them with python being the most dramatic exception are also very syntactically similar to c in general and they tend to combine the recognizable expression and statement syntax of c with underlying type systems data models and semantics that can be radically different history early developments year c standard 1972 birth 1978 kr c 19891990 ansi c and iso c 1999 c99 2011 c11 20172018 c18 the origin of c is closely tied to the development of the unix operating system originally implemented in assembly language on a pdp7 by dennis ritchie and ken thompson incorporating several ideas from colleagues eventually they decided to port the operating system to a pdp11 the original pdp11 version of unix was developed in assembly language the developers were considering rewriting the system using the b language thompsons simplified version of bcpl the development of c started in 1972 on the pdp11 unix system also in 1972 a large part of unix was rewritten in c by 1973 with the addition of struct types the c language had become powerful enough that most of the unix kernel was now in c unix was one of the first operating system kernels implemented in a language other than assembly earlier instances include the multics system which was written in pli and master control program mcp for the burroughs b5000 which was written in algol in 1961 in around 1977 ritchie and stephen c johnson made further changes to the language to facilitate portability of the unix operating system johnsons portable c compiler served as the basis for several implementations of c on new platforms kr c the cover of the book the c programming language first edition by brian kernighan and dennis ritchie in 1978 brian kernighan and dennis ritchie published the first edition of the c programming language covers the later ansi c standard described below kr introduced several language features standard io library long int data type unsigned int data type compound assignment operators of the form op such as were changed to the form op that is to remove the semantic ambiguity created by constructs such as i10 which had been interpreted as i10 decrement i by 10 instead of the possibly intended i10 let i be 10 even after the publication of the 1989 ansi standard for many years kr c was still considered the lowest common denominator to which c programmers restricted themselves when maximum portability was desired since many older compilers were still in use and because carefully written kr c code can be legal standard c as well in early versions of c only functions that return types other than int must be declared if used before the function definition functions used without prior declaration were presumed to return type int for example long somefunction int otherfunction int callingfunction long test1 register int test2 test1 somefunction if test1 0 test2 0 else test2 otherfunction return test2 the int type specifiers which are commented out could be omitted in kr c but are required in later standards since kr function declarations did not include any information about function arguments function parameter type checks were not performed although some compilers would issue a warning message if a local function was called with the wrong number of arguments or if multiple calls to an external function used different numbers or types of arguments separate tools such as unixs lint utility were developed that among other things could check for consistency of function use across multiple source files in the years following the publication of kr c several features were added to the language supported by compilers from att in particular pcc and some other vendors these included void functions ie functions with no return value functions returning struct or union types rather than pointers assignment for struct data types enumerated types the large number of extensions and lack of agreement on a standard library together with the language popularity and the fact that not even the unix compilers precisely implemented the kr specification led to the necessity of standardization ansi c and iso c ansi c during the late 1970s and 1980s versions of c were implemented for a wide variety of mainframe computers minicomputers and microcomputers including the ibm pc as its popularity began to increase significantly in 1983 the american national standards institute ansi formed a committee x3j11 to establish a standard specification of c x3j11 based the c standard on the unix implementation however the nonportable portion of the unix c library was handed off to the ieee working group 1003 to become the basis for the 1988 posix standard in 1989 the c standard was ratified as ansi x31591989 programming language c this version of the language is often referred to as ansi c standard c or sometimes c89 in 1990 the ansi c standard with formatting changes was adopted by the international organization for standardization iso as isoiec 98991990 which is sometimes called c90 therefore the terms c89 and c90 refer to the same programming language ansi like other national standards bodies no longer develops the c standard independently but defers to the international c standard maintained by the working group isoiec jtc1sc22wg14 national adoption of an update to the international standard typically occurs within a year of iso publication one of the aims of the c standardization process was to produce a superset of kr c incorporating many of the subsequently introduced unofficial features the standards committee also included several additional features such as function prototypes borrowed from c void pointers support for international character sets and locales and preprocessor enhancements although the syntax for parameter declarations was augmented to include the style used in c the kr interface continued to be permitted for compatibility with existing source code c89 is supported by current c compilers and most c code being written today is based on it any program written only in standard c and without any hardwaredependent assumptions will run correctly on any platform with a conforming c implementation within its resource limits without such precautions programs may compile only on a certain platform or with a particular compiler due for example to the use of nonstandard libraries such as gui libraries or to a reliance on compiler or platformspecific attributes such as the exact size of data types and byte endianness in cases where code must be compilable by either standardconforming or kr cbased compilers the stdc macro can be used to split the code into standard and kr sections to prevent the use on a kr cbased compiler of features available only in standard c after the ansiiso standardization process the c language specification remained relatively static for several years in 1995 normative amendment 1 to the 1990 c standard isoiec 9899amd11995 known informally as c95 was published to correct some details and to add more extensive support for international character sets c99 c99 the c standard was further revised in the late 1990s leading to the publication of isoiec 98991999 in 1999 which is commonly referred to as c99 it has since been amended three times by technical corrigenda c99 introduced several new features including inline functions several new data types including long long int and a complex type to represent complex numbers variablelength arrays and flexible array members improved support for ieee 754 floating point support for variadic macros macros of variable arity and support for oneline comments beginning with as in bcpl or c many of these had already been implemented as extensions in several c compilers c99 is for the most part backward compatible with c90 but is stricter in some ways in particular a declaration that lacks a type specifier no longer has int implicitly assumed a standard macro stdcversion is defined with value 199901l to indicate that c99 support is available gcc solaris studio and other c compilers now support many or all of the new features of c99 the c compiler in microsoft visual c however implements the c89 standard and those parts of c99 that are required for compatibility with c11 c11 c11 c standard revision in 2007 work began on another revision of the c standard informally called c1x until its official publication on 20111208 the c standards committee adopted guidelines to limit the adoption of new features that had not been tested by existing implementations the c11 standard adds numerous new features to c and the library including type generic macros anonymous structures improved unicode support atomic operations multithreading and boundschecked functions it also makes some portions of the existing c99 library optional and improves compatibility with c the standard macro stdcversion is defined as 201112l to indicate that c11 support is available c18 c18 c standard revision published in june 2018 c18 is the current standard for the c programming language it introduces no new language features only technical corrections and clarifications to defects in c11 the standard macro stdcversion is defined as 201710l embedded c embedded c historically embedded c programming requires nonstandard extensions to the c language in order to support exotic features such as fixedpoint arithmetic multiple distinct memory banks and basic io operations in 2008 the c standards committee published a technical report extending the c language to address these issues by providing a common standard for all implementations to adhere to it includes a number of features not available in normal c such as fixedpoint arithmetic named address spaces and basic io hardware addressing syntax c syntax c has a formal grammar specified by the c standard c source files contain declarations and function definitions function definitions in turn contain declarations and statements declarations either define new types using keywords such as struct union and enum or assign types to and perhaps reserve storage for new variables usually by writing the type followed by the variable name keywords such as char and int specify builtin types sections of code are enclosed in braces and sometimes called curly brackets to limit the scope of declarations and to act as a single statement for control structures as an imperative language c uses statements to specify actions the most common statement is an expression statement consisting of an expression to be evaluated followed by a semicolon as a side effect of the evaluation functions may be called and variables may be assigned new values to modify the normal sequential execution of statements c provides several controlflow statements identified by reserved keywords structured programming is supported by ifelse conditional execution and by dowhile while and for iterative execution looping the for statement has separate initialization testing and reinitialization expressions any or all of which can be omitted break and continue can be used to leave the innermost enclosing loop statement or skip to its reinitialization there is also a nonstructured goto statement which branches directly to the designated label within the function switch selects a case to be executed based on the value of an integer expression expressions can use a variety of builtin operators and may contain function calls the order in which arguments to functions and operands to most operators are evaluated is unspecified the evaluations may even be interleaved however all side effects including storage to variables will occur before the next sequence point sequence points include the end of each expression statement and the entry to and return from each function call sequence points also occur during evaluation of expressions containing certain operators and the comma operator this permits a high degree of object code optimization by the compiler but requires c programmers to take more care to obtain reliable results than is needed for other programming languages kernighan and ritchie say in the introduction of the c programming language c like any other language has its blemishes some of the operators have the wrong precedence some parts of the syntax could be better the c standard did not attempt to correct many of these blemishes because of the impact of such changes on already existing software character set the basic c source character set includes the following characters lowercase and uppercase letters of iso basic latin alphabet az az decimal digits 09 graphic characters whitespace characters space horizontal tab vertical tab form feed newline newline indicates the end of a text line it need not correspond to an actual single character although for convenience c treats it as one additional multibyte encoded characters may be used in string literals but they are not entirely portable the latest c standard c11 allows multinational unicode characters to be embedded portably within c source text by using uxxxx or uxxxxxxxx encoding where the x denotes a hexadecimal character although this feature is not yet widely implemented the basic c execution character set contains the same characters along with representations for alert backspace and carriage return runtime support for extended character sets has increased with each revision of the c standard reserved words c89 has 32 reserved words also known as keywords which are the words that cannot be used for any purposes other than those for which they are predefined auto break case char const continue default do double else enum extern float for goto if int long register return short signed sizeof static struct switch typedef union unsigned void volatile while c99 reserved five more words bool complex imaginary inline restrict c11 reserved seven more words alignas alignof atomic generic noreturn staticassert threadlocal most of the recently reserved words begin with an underscore followed by a capital letter because identifiers of that form were previously reserved by the c standard for use only by implementations since existing program source code should not have been using these identifiers it would not be affected when c implementations started supporting these extensions to the programming language some standard headers do define more convenient synonyms for underscored identifiers the language previously included a reserved word called entry but this was seldom implemented and has now been removed as a reserved word operators operators in c and c c supports a rich set of operators which are symbols used within an expression to specify the manipulations to be performed while evaluating that expression c has operators for arithmetic assignment augmented assignment bitwise logic bitwise shifts boolean logic conditional evaluation equality testing calling functions increment and decrement member selection object size sizeof order relations reference and dereference sequencing subexpression grouping type conversion typename c uses the operator used in mathematics to express equality to indicate assignment following the precedent of fortran and pli but unlike algol and its derivatives c uses the operator to test for equality the similarity between these two operators assignment and equality may result in the accidental use of one in place of the other and in many cases the mistake does not produce an error message although some compilers produce warnings for example the conditional expression ifab1 might mistakenly be written as ifab1 which will be evaluated as true if a is not zero after the assignment the c operator precedence is not always intuitive for example the operator binds more tightly than is executed prior to the operators bitwise and and bitwise or in expressions such as x 1 0 which must be written as x 1 0 if that is the coders intent hello world example the hello world example which appeared in the first edition of kr has become the model for an introductory program in most programming textbooks regardless of programming language the program prints hello world to the standard output which is usually a terminal or screen display the original version was main printfhello worldn a standardconforming hello world program is include stdioh int mainvoid printfhello worldn the first line of the program contains a preprocessing directive indicated by include this causes the compiler to replace that line with the entire text of the stdioh standard header which contains declarations for standard input and output functions such as printf the angle brackets surrounding stdioh indicate that stdioh is located using a search strategy that prefers headers provided with the compiler to other headers having the same name as opposed to double quotes which typically include local or projectspecific header files the next line indicates that a function named main is being defined the main function serves a special purpose in c programs the runtime environment calls the main function to begin program execution the type specifier int indicates that the value that is returned to the invoker in this case the runtime environment as a result of evaluating the main function is an integer the keyword void as a parameter list indicates that this function takes no arguments the opening curly brace indicates the beginning of the definition of the main function the next line calls diverts execution to a function named printf which in this case is supplied from a system library in this call the printf function is passed provided with a single argument the address of the first character in the string literal hello worldn the string literal is an unnamed array with elements of type char set up automatically by the compiler with a final 0valued character to mark the end of the array printf needs to know this the n is an escape sequence that c translates to a newline character which on output signifies the end of the current line the return value of the printf function is of type int but it is silently discarded since it is not used a more careful program might test the return value to determine whether or not the printf function succeeded the semicolon terminates the statement the closing curly brace indicates the end of the code for the main function according to the c99 specification and newer the main function unlike any other function will implicitly return a value of 0 upon reaching the that terminates the function formerly an explicit return 0 statement was required this is interpreted by the runtime system as an exit code indicating successful execution data types c variable types and declarations the type system in c is static and weakly typed which makes it similar to the type system of algol descendants such as pascal there are builtin types for integers of various sizes both signed and unsigned floatingpoint numbers and enumerated types enum integer type char is often used for singlebyte characters c99 added a boolean datatype there are also derived types including arrays pointers records struct and unions union c is often used in lowlevel systems programming where escapes from the type system may be necessary the compiler attempts to ensure type correctness of most expressions but the programmer can override the checks in various ways either by using a type cast to explicitly convert a value from one type to another or by using pointers or unions to reinterpret the underlying bits of a data object in some other way some find cs declaration syntax unintuitive particularly for function pointers ritchies idea was to declare identifiers in contexts resembling their use declaration reflects use cs usual arithmetic conversions allow for efficient code to be generated but can sometimes produce unexpected results for example a comparison of signed and unsigned integers of equal width requires a conversion of the signed value to unsigned this can generate unexpected results if the signed value is negative pointers c supports the use of pointers a type of reference that records the address or location of an object or function in memory pointers can be dereferenced to access data stored at the address pointed to or to invoke a pointedto function pointers can be manipulated using assignment or pointer arithmetic the runtime representation of a pointer value is typically a raw memory address perhaps augmented by an offsetwithinword field but since a pointers type includes the type of the thing pointed to expressions including pointers can be typechecked at compile time pointer arithmetic is automatically scaled by the size of the pointedto data type pointers are used for many purposes in c text strings are commonly manipulated using pointers into arrays of characters dynamic memory allocation is performed using pointers many data types such as trees are commonly implemented as dynamically allocated struct objects linked together using pointers pointers to functions are useful for passing functions as arguments to higherorder functions such as qsort or bsearch or as callbacks to be invoked by event handlers a null pointer value explicitly points to no valid location dereferencing a null pointer value is undefined often resulting in a segmentation fault null pointer values are useful for indicating special cases such as no next pointer in the final node of a linked list or as an error indication from functions returning pointers in appropriate contexts in source code such as for assigning to a pointer variable a null pointer constant can be written as 0 with or without explicit casting to a pointer type or as the null macro defined by several standard headers in conditional contexts null pointer values evaluate to false while all other pointer values evaluate to true void pointers void point to objects of unspecified type and can therefore be used as generic data pointers since the size and type of the pointedto object is not known void pointers cannot be dereferenced nor is pointer arithmetic on them allowed although they can easily be and in many contexts implicitly are converted to and from any other object pointer type careless use of pointers is potentially dangerous because they are typically unchecked a pointer variable can be made to point to any arbitrary location which can cause undesirable effects although properly used pointers point to safe places they can be made to point to unsafe places by using invalid pointer arithmetic the objects they point to may continue to be used after deallocation dangling pointers they may be used without having been initialized wild pointers or they may be directly assigned an unsafe value using a cast union or through another corrupt pointer in general c is permissive in allowing manipulation of and conversion between pointer types although compilers typically provide options for various levels of checking some other programming languages address these problems by using more restrictive reference types arrays see also c string array types in c are traditionally of a fixed static size specified at compile time the more recent c99 standard also allows a form of variablelength arrays however it is also possible to allocate a block of memory of arbitrary size at runtime using the standard librarys malloc function and treat it as an array cs unification of arrays and pointers means that declared arrays and these dynamically allocated simulated arrays are virtually interchangeable since arrays are always accessed in effect via pointers array accesses are typically not checked against the underlying array size although some compilers may provide bounds checking as an option array bounds violations are therefore possible and rather common in carelessly written code and can lead to various repercussions including illegal memory accesses corruption of data buffer overruns and runtime exceptions if bounds checking is desired it must be done manually c does not have a special provision for declaring multidimensional arrays but rather relies on recursion within the type system to declare arrays of arrays which effectively accomplishes the same thing the index values of the resulting multidimensional array can be thought of as increasing in rowmajor order multidimensional arrays are commonly used in numerical algorithms mainly from applied linear algebra to store matrices the structure of the c array is well suited to this particular task however since arrays are passed merely as pointers the bounds of the array must be known fixed values or else explicitly passed to any subroutine that requires them and dynamically sized arrays of arrays cannot be accessed using double indexing a workaround for this is to allocate the array with an additional row vector of pointers to the columns c99 introduced variablelength arrays which address some but not all of the issues with ordinary c arrays arraypointer interchangeability the subscript notation x designates the i1th element of the array furthermore in most expression contexts a notable exception is as operand of sizeof the name of an array is automatically converted to a pointer to the arrays first element this implies that an array is never copied as a whole when named as an argument to a function but rather only the address of its first element is passed therefore although function calls in c use passbyvalue semantics arrays are in effect passed by reference the size of an element can be determined by applying the operator sizeof to any dereferenced element of x as in n sizeof x or n sizeof x since array name arguments to sizeof are not converted to pointers they do not exhibit such ambiguity however arrays created by dynamic allocation are accessed by pointers rather than true array variables so they suffer from the same sizeof issues as array pointers thus despite this apparent equivalence between array and pointer variables there is still a distinction to be made between them even though the name of an array is in most expression contexts converted into a pointer to its first element this pointer does not itself occupy any storage the array name is not an lvalue and its address is a constant unlike a pointer variable consequently what an array points to cannot be changed and it is impossible to assign a new address to an array name array contents may be copied however by using the memcpy function or by accessing the individual elements memory management one of the most important functions of a programming language is to provide facilities for managing memory and the objects that are stored in memory c provides three distinct ways to allocate memory for objects static memory allocation space for the object is provided in the binary at compiletime these objects have an extent or lifetime as long as the binary which contains them is loaded into memory automatic memory allocation temporary objects can be stored on the stack and this space is automatically freed and reusable after the block in which they are declared is exited dynamic memory allocation blocks of memory of arbitrary size can be requested at runtime using library functions such as malloc from a region of memory called the heap these blocks persist until subsequently freed for reuse by calling the library function realloc or free these three approaches are appropriate in different situations and have various tradeoffs for example static memory allocation has little allocation overhead automatic allocation may involve slightly more overhead and dynamic memory allocation can potentially have a great deal of overhead for both allocation and deallocation the persistent nature of static objects is useful for maintaining state information across function calls automatic allocation is easy to use but stack space is typically much more limited and transient than either static memory or heap space and dynamic memory allocation allows convenient allocation of objects whose size is known only at runtime most c programs make extensive use of all three where possible automatic or static allocation is usually simplest because the storage is managed by the compiler freeing the programmer of the potentially errorprone chore of manually allocating and releasing storage however many data structures can change in size at runtime and since static allocations and automatic allocations before c99 must have a fixed size at compiletime there are many situations in which dynamic allocation is necessary prior to the c99 standard variablesized arrays were a common example of this see the article on malloc for an example of dynamically allocated arrays unlike automatic allocation which can fail at run time with uncontrolled consequences the dynamic allocation functions return an indication in the form of a null pointer value when the required storage cannot be allocated static allocation that is too large is usually detected by the linker or loader before the program can even begin execution unless otherwise specified static objects contain zero or null pointer values upon program startup automatically and dynamically allocated objects are initialized only if an initial value is explicitly specified otherwise they initially have indeterminate values typically whatever bit pattern happens to be present in the storage which might not even represent a valid value for that type if the program attempts to access an uninitialized value the results are undefined many modern compilers try to detect and warn about this problem but both false positives and false negatives can occur another issue is that heap memory allocation has to be synchronized with its actual usage in any program in order for it to be reused as much as possible for example if the only pointer to a heap memory allocation goes out of scope or has its value overwritten before free is called then that memory cannot be recovered for later reuse and is essentially lost to the program a phenomenon known as a memory leak conversely it is possible for memory to be freed but continue to be referenced leading to unpredictable results typically the symptoms will appear in a portion of the program far removed from the actual error making it difficult to track down the problem such issues are ameliorated in languages with automatic garbage collection libraries the c programming language uses libraries as its primary method of extension in c a library is a set of functions contained within a single archive file each library typically has a header file which contains the prototypes of the functions contained within the library that may be used by a program and declarations of special data types and macro symbols used with these functions in order for a program to use a library it must include the librarys header file and the library must be linked with the program which in many cases requires compiler flags eg lm shorthand for link the math library the most common c library is the c standard library which is specified by the iso and ansi c standards and comes with every c implementation implementations which target limited environments such as embedded systems may provide only a subset of the standard library this library supports stream input and output memory allocation mathematics character strings and time values several separate standard headers for example stdioh specify the interfaces for these and other standard library facilities another common set of c library functions are those used by applications specifically targeted for unix and unixlike systems especially functions which provide an interface to the kernel these functions are detailed in various standards such as posix and the single unix specification since many programs have been written in c there are a wide variety of other libraries available libraries are often written in c because c compilers generate efficient object code programmers then create interfaces to the library so that the routines can be used from higherlevel languages like java perl and python language tools this section needs additional citations for verification please help improve this article by adding citations to reliable sources unsourced material may be challenged and removed july 2014 learn how and when to remove this template message a number of tools have been developed to help c programmers find and fix statements with undefined behavior or possibly erroneous expressions with greater rigor than that provided by the compiler the tool lint was the first such leading to many others automated source code checking and auditing are beneficial in any language and for c many such tools exist such as lint a common practice is to use lint to detect questionable code when a program is first written once a program passes lint it is then compiled using the c compiler also many compilers can optionally warn about syntactically valid constructs that are likely to actually be errors misra c is a proprietary set of guidelines to avoid such questionable code developed for embedded systems there are also compilers libraries and operating system level mechanisms for performing actions that are not a standard part of c such as bounds checking for arrays detection of buffer overflow serialization dynamic memory tracking and automatic garbage collection tools such as purify or valgrind and linking with libraries containing special versions of the memory allocation functions can help uncover runtime errors in memory usage uses the tiobe index graph showing a comparison of the popularity of various programming languages c is widely used for system programming in implementing operating systems and embedded system applications because c code when written for portability can be used for most purposes yet when needed systemspecific code can be used to access specific hardware addresses and to perform type punning to match externally imposed interface requirements with a low runtime demand on system resources c can also be used for website programming using cgi as a gateway for information between the web application the server and the browser one consequence of cs wide availability and efficiency is that compilers libraries and interpreters of other programming languages are often implemented in c the reference implementations of python perl and php for example are all written in c because the layer of abstraction is thin and the overhead is low c enables programmers to create efficient implementations of algorithms and data structures useful for computationally intense programs for example the gnu multiple precision arithmetic library the gnu scientific library mathematica and matlab are completely or partially written in c c is sometimes used as an intermediate language by implementations of other languages this approach may be used for portability or convenience by using c as an intermediate language additional machinespecific code generators are not necessary c has some features such as linenumber preprocessor directives and optional superfluous commas at the end of initializer lists that support compilation of generated code however some of cs shortcomings have prompted the development of other cbased languages specifically designed for use as intermediate languages such as c c has also been widely used to implement enduser applications however such applications can also be written in newer higherlevel languages related languages c has both directly and indirectly influenced many later languages such as c d go java javascript limbo lpc perl php python and unixs c shell the most pervasive influence has been syntactical all of the languages mentioned combine the statement and more or less recognizably expression syntax of c with type systems data models andor largescale program structures that differ from those of c sometimes radically several c or nearc interpreters exist including ch and cint which can also be used for scripting when objectoriented languages became popular c and objectivec were two different extensions of c that provided objectoriented capabilities both languages were originally implemented as sourcetosource compilers source code was translated into c and then compiled with a c compiler the c programming language was devised by bjarne stroustrup as an approach to providing objectoriented functionality with a clike syntax c adds greater typing strength scoping and other tools useful in objectoriented programming and permits generic programming via templates nearly a superset of c c now supports most of c with a few exceptions objectivec was originally a very thin layer on top of c and remains a strict superset of c that permits objectoriented programming using a hybrid dynamicstatic typing paradigm objectivec derives its syntax from both c and smalltalk syntax that involves preprocessing expressions function declarations and function calls is inherited from c while the syntax for objectoriented features was originally taken from smalltalk in addition to c and objectivec ch cilk and unified parallel c are nearly supersets of c c programming language portal compatibility of c and c comparison of pascal and c comparison of programming languages international obfuscated c code contest list of cbased programming languages list of c compilers notes ritchie dennis m 1993 the development of the c language the second acm sigplan history of programming languages conference hoplii cambridge ma usa april 2023 1993 acm pp201208 doi101145154766155580 isbn0897915704 retrieved 20141104 banahan m brady d doran m 1991 the c book 2nd ed addisonwesley king k n april 2008 c programming a modern approach 2nd ed norton isbn9780393979503 thompson ken a new c compiler pdf murray hill new jersey att bell laboratories feuer alan r 1998 the c puzzle book 1st revised printing ed addisonwesley isbn9780201604610 c programming languageat wikipedias sister projects media from wikimedia commons news from wikinews quotations from wikiquote textbooks from wikibooks resources from wikiversity iso c working group official website complangc frequently asked questions isoiec 9899 publicly available official c documents including the c99 rationale c99 with technical corrigenda tc1 tc2 and tc3 included pdf361mb a history of c by dennis ritchie vtec programming language ansi c c89 and c90 c99 c11 c18 embedded c misra c features functions header files libraries operators string syntax preprocessor data types standard libraryfunctions char ctypeh file io stdioh math mathh dynamic memory stdlibh string stringh time timeh variadic stdargh posix standardlibraries bionic libhybris dietlibc eglibc glibc klibc microsoft runtime library musl newlib uclibc bsd libc compilers comparison of compilers ack borland turbo c clang gcc icc lcc pcc sdcc tcc microsoft visual studio express c watcom cc ides comparison of ides anjuta codeblocks codelite eclipse geany microsoft visual studio netbeans comparison withother languages compatibility of c and c comparison with embedded c comparison with pascal comparison of programming languages descendantlanguages c c d objectivec alef limbo go vala category vteintegrated development environmentsc and copen source android studio anjuta codeblocks codelite devc eclipse geany gnat programming studio gnome builder kdevelop monodevelop netbeans qdevelop qt creator sharpdevelop ultimate openwatcom freeware oracle developer studio visual studio community xcode retail cbuilder eclipsebased codewarrior myeclipse visual studio by jetbrains intellij idea appcode clion labwindowscvi lccwin32 ibm rational software architect understand discontinued ibm visualage visual c express javaopen source bluej drjava eclipse geany greenfoot intellij idea community edition android studio netbeans servoy community edition freeware jgrasp jdeveloper xcode retail jbuilder jcreator myeclipse ibm rational application developer websphere integration developer jetbrains intellij idea servoy business application platform edition understand discontinued metrowerks codewarrior pro for java sun java studio creator superseded by netbeans visual age superseded by eclipse visual caf aka espresso superseded by jbuilder visual j xelfi became netbeans cliopen source monodevelop sharpdevelop visual studio code pascalabcnet freeware visual studio community retail visual studio rider understand discontinued xamarin studio visual basic express visual web developer express visual j express visual studio express for windows phone visual c express visual c express express for desktop express for web express for windows flash adobe flash builder flashdevelop powerflasher fdt php aptana netbeans phpstorm kdevelop python eric intellij idea light table ninjaide pycharm pydev spyder wing ide kdevelop pascal and object pascalopen source free pascal ide lazarus devpascal freeware delphi community retail delphi discontinued turbo pascal for windows virtual pascal r rstudio r tools for visual studio category comparison vteprogramming languages comparison timeline history apl assembly basic c c c cobol fortran go groovy haskell java javascript js kotlin lisp lua objectivec pascal perl php python ruby rust shell smalltalk swift visual basic net vbnet more category lists alphabetical categorical generational nonenglishbased authority control bnf cb119665180 data gnd 41131952 lccn sh85018532 sudoc 027672441 