You are on page 1of 20

C(programminglanguage)

FromWikipedia,thefreeencyclopedia

Thisarticleisabouttheprogramminglanguage.Forotheruses,seeC(disambiguation).
C(/si/,asintheletterc)isageneralpurpose,
imperativecomputerprogramminglanguage,supporting
structuredprogramming,lexicalvariablescopeand
recursion,whileastatictypesystempreventsmany
unintendedoperations.Bydesign,Cprovidesconstructs
thatmapefficientlytotypicalmachineinstructions,and
thereforeithasfoundlastinguseinapplicationsthathad
formerlybeencodedinassemblylanguage,including
operatingsystems,aswellasvariousapplication
softwareforcomputersrangingfromsupercomputersto
embeddedsystems.
CwasoriginallydevelopedbyDennisRitchiebetween
1969and1973atAT&TBellLabs,[5]andusedtore
implementtheUnixoperatingsystem.[6]Ithassince
becomeoneofthemostwidelyusedprogramming
languagesofalltime,[7][8]withCcompilersfromvarious
vendorsavailableforthemajorityofexistingcomputer
architecturesandoperatingsystems.Chasbeen
standardizedbytheAmericanNationalStandards
Institute(ANSI)since1989(seeANSIC)and
subsequentlybytheInternationalOrganizationfor
Standardization(ISO).
Manylaterlanguageshaveborroweddirectlyor
indirectlyfromC,includingC++,D,Go,Rust,Java,
JavaScript,Limbo,LPC,C#,ObjectiveC,Perl,PHP,
Python,Verilog(hardwaredescriptionlanguage),[4]and
Unix'sCshell.Theselanguageshavedrawnmanyof
theircontrolstructuresandotherbasicfeaturesfromC,
usuallywithoverallsyntacticalsimilaritytoCthat
sometimesincludesidenticalsimplecontrol
structures.[9][10][11]Cisalsousedasanintermediate
languageforotherlanguages,[12]andforbuilding
standardlibrariesandruntimesystemsforhigherlevel
languages,suchasCPython.[13]

Contents
1Design
2Overview

TheCProgrammingLanguage[1](oftenreferredto
as"K&R"),theseminalbookonC
Paradigm

Imperative(procedural),structured

Designedby

DennisRitchie

Developer

DennisRitchie&BellLabs
(creators)ANSIX3J11(ANSIC)
ISO/IECJTC1/SC22/WG14(ISO
C)

Firstappeared 1972[2]
Stablerelease C11/December2011
Typing
discipline

Static,weak,manifest,nominal

OS

Platformindependent

Filename
extensions

.c,.h
Majorimplementations

GCC,Clang,IntelC,MSVC,PellesC,WatcomC
Dialects
Cyclone,UnifiedParallelC,SplitC,Cilk,C*
Influencedby
B(BCPL,CPL),ALGOL68, [3]Assembly,PL/I,
FORTRAN
Influenced
Numerous:AMPL,AWK,csh,C++,C,C#,
ObjectiveC,BitC,D,Go,Rust,Java,JavaScript,
Limbo,LPC,Perl,PHP,Pike,Processing,Python,

2Overview
2.1Relationstootherlanguages
3History
3.1Earlydevelopments
3.2K&RC
3.3ANSICandISOC
3.4C99
3.5C11
3.6EmbeddedC
4Syntax
4.1Characterset
4.2Keywords
4.3Operators
5"Hello,world"example
6Datatypes
6.1Pointers
6.2Arrays
6.3Arraypointerinterchangeability
7Memorymanagement
8Libraries
9Languagetools
10Uses
11Relatedlanguages
12Seealso
13Notes
14References
15Furtherreading
16Externallinks

Seed7,Verilog(HDL)[4]
CProgrammingatWikibooks

Design
Cisanimperative(procedural)language.Itwasdesignedtobecompiledusingarelativelystraightforward
compiler,toprovidelowlevelaccesstomemory,toprovidelanguageconstructsthatmapefficientlyto
machineinstructions,andtorequireminimalruntimesupport.Cwasthereforeusefulformany
applicationsthathadformerlybeencodedinassemblylanguage,suchasinsystemprogramming.
Despiteitslowlevelcapabilities,thelanguagewasdesignedtoencouragecrossplatformprogramming.A
standardscompliantandportablywrittenCprogramcanbecompiledforaverywidevarietyofcomputer
platformsandoperatingsystemswithfewchangestoitssourcecode.Thelanguagehasbecomeavailable
onaverywiderangeofplatforms,fromembeddedmicrocontrollerstosupercomputers.

Overview
LikemostimperativelanguagesintheALGOLtradition,Chasfacilitiesforstructuredprogrammingand
allowslexicalvariablescopeandrecursion,whileastatictypesystempreventsmanyunintended
operations.InC,allexecutablecodeiscontainedwithinsubroutines,whicharecalled"functions"(although

notinthestrictsenseoffunctionalprogramming).Functionparametersarealwayspassedbyvalue.Pass
byreferenceissimulatedinCbyexplicitlypassingpointervalues.Cprogramsourcetextisfreeformat,
usingthesemicolonasastatementterminatorandcurlybracesforgroupingblocksofstatements.
TheClanguagealsoexhibitsthefollowingcharacteristics:
Thereisasmall,fixednumberofkeywords,includingafullsetofflowofcontrolprimitives:for,
if/else,while,switch,anddo/while.Thereisonenamespace,anduserdefinednamesarenot
distinguishedfromkeywordsbyanykindofsigil.
Therearealargenumberofarithmeticalandlogicaloperators,suchas+,+=,++,&,~,etc.
Morethanoneassignmentmaybeperformedinasinglestatement.
Functionreturnvaluescanbeignoredwhennotneeded.
Typingisstatic,butweaklyenforced:alldatahasatype,butimplicitconversionscanbeperformed
forinstance,characterscanbeusedasintegers.
Declarationsyntaxmimicsusagecontext.Chasno"define"keywordinstead,astatementbeginning
withthenameofatypeistakenasadeclaration.Thereisno"function"keywordinstead,afunction
isindicatedbytheparenthesesofanargumentlist.
Userdefined(typedef)andcompoundtypesarepossible.
Heterogeneousaggregatedatatypes(struct)allowrelateddataelementstobeaccessedand
assignedasaunit.
Arrayindexingisasecondarynotation,definedintermsofpointerarithmetic.Unlikestructs,
arraysarenotfirstclassobjectstheycannotbeassignedorcomparedusingsinglebuiltin
operators.Thereisno"array"keyword,inuseordefinitioninstead,squarebracketsindicate
arrayssyntactically,forexamplemonth[11].
Enumeratedtypesarepossiblewiththeenumkeyword.Theyarenottagged,andarefreely
interconvertiblewithintegers.
Stringsarenotaseparatedatatype,butareconventionallyimplementedasnullterminated
arraysofcharacters.
Lowlevelaccesstocomputermemoryispossiblebyconvertingmachineaddressestotypedpointers.
Procedures(subroutinesnotreturningvalues)areaspecialcaseoffunction,withanuntypedreturn
typevoid.
Functionsmaynotbedefinedwithinthelexicalscopeofotherfunctions.
Functionanddatapointerspermitadhocruntimepolymorphism.
Apreprocessorperformsmacrodefinition,sourcecodefileinclusion,andconditionalcompilation.
Thereisabasicformofmodularity:filescanbecompiledseparatelyandlinkedtogether,with
controloverwhichfunctionsanddataobjectsarevisibletootherfilesviastaticandextern
attributes.
ComplexfunctionalitysuchasI/O,stringmanipulation,andmathematicalfunctionsareconsistently
delegatedtolibraryroutines.
Cdoesnotincludesomefeaturesfoundinnewer,moremodernhighlevellanguages,includingobject
orientationandgarbagecollection.

Relationstootherlanguages
ManylaterlanguageshaveborroweddirectlyorindirectlyfromC,includingC++,D,Go,Rust,Java,
JavaScript,Limbo,LPC,C#,ObjectiveC,Perl,PHP,Python,Verilog(hardwaredescriptionlanguage),[4]
andUnix'sCshell.Theselanguageshavedrawnmanyoftheircontrolstructuresandotherbasicfeatures

fromC.Mostofthem(withPythonbeingthemostdramaticexception)arealsoverysyntacticallysimilarto
Cingeneral,andtheytendtocombinetherecognizableexpressionandstatementsyntaxofCwith
underlyingtypesystems,datamodels,andsemanticsthatcanberadicallydifferent.

History
Earlydevelopments
TheoriginofCiscloselytiedtothedevelopmentoftheUnix
operatingsystem,originallyimplementedinassemblylanguageona
PDP7byRitchieandThompson,incorporatingseveralideasfrom
colleagues.Eventuallytheydecidedtoporttheoperatingsystemtoa
PDP11.TheoriginalPDP11versionofUnixwasdevelopedin
assemblylanguage.Thedeveloperswereconsideringtorewritethe
systemusingtheBlanguage,Thompson'ssimplifiedversionof
BCPL.[14]HoweverB'sinabilitytotakeadvantageofsomeofthe
PDP11'sfeatures,notablybyteaddressability,ledtoC.

KenThompson(left)withDennis
Ritchie(right,theinventoroftheC
programminglanguage)

ThedevelopmentofCstartedin1972onthePDP11Unix
system,[15]andfirstappearedinVersion2Unix.[16]Thelanguage
wasnotinitiallydesignedwithportabilityinmind,butsoonranon
differentplatformsaswell:acompilerfortheHoneywell6000waswrittenwithinthefirstyearofC's
history,whileanIBMSystem/370portfollowedsoon.[1][15]

Alsoin1972,alargepartofUnixwasrewritteninC.[17]By1973,withtheadditionofstructtypes,theC
languagehadbecomepowerfulenoughthatmostoftheUnix'skernelwasnowinC.
Unixwasoneofthefirstoperatingsystemkernelsimplementedinalanguageotherthanassembly.(Earlier
instancesincludetheMulticssystem(writteninPL/I),andMCP(MasterControlProgram)forthe
BurroughsB5000writteninALGOLin1961.)Circa1977,furtherchangestothelanguageweremadeby
RitchieandStephenC.JohnsontofacilitateportabilityoftheUnixoperatingsystem.Johnson'sPortableC
CompilerservedasthebasisforseveralimplementationsofConnewplatforms.[15]

K&RC
In1978,BrianKernighanandDennisRitchiepublishedthefirsteditionofTheCProgramming
Language.[1]Thisbook,knowntoCprogrammersas"K&R",servedformanyyearsasaninformal
specificationofthelanguage.TheversionofCthatitdescribesiscommonlyreferredtoasK&RC.The
secondeditionofthebook[18]coversthelaterANSICstandard,describedbelow.
K&Rintroducedseverallanguagefeatures:
standardI/Olibrary
longintdatatype
unsignedintdatatype
compoundassignmentoperatorsoftheform=op(suchas=)werechangedtotheformop=(thatis,
=)toremovethesemanticambiguitycreatedbysuchconstructsasi=10,whichhadbeeninterpreted

asi=10(decrementiby10)insteadofthepossiblyintendedi=10(letibe10)
Evenafterthepublicationofthe1989ANSIstandard,formanyyearsK&RCwasstillconsideredthe
"lowestcommondenominator"towhichCprogrammersrestrictedthemselveswhenmaximumportability
wasdesired,sincemanyoldercompilerswerestillinuse,andbecausecarefullywrittenK&RCcodecan
belegalStandardCaswell.
InearlyversionsofC,onlyfunctionsthatreturnedanonintvalueneededtobedeclaredifusedbeforethe
functiondefinitionafunctionusedwithoutanypreviousdeclarationwasassumedtoreturntypeint,ifits
valuewasused.
Forexample:
longsome_function();
/*int*/other_function();
/*int*/calling_function()
{
longtest1;
register/*int*/test2;
test1=some_function();
if(test1>0)
test2=0;
else
test2=other_function();
returntest2;
}

TheinttypespecifierswhicharecommentedoutcouldbeomittedinK&R
C,butarerequiredinlaterstandards.

Thecoverofthebook,The
CProgrammingLanguage

SinceK&Rfunctiondeclarationsdidnotincludeanyinformationabout
functionarguments,functionparametertypecheckswerenotperformed,althoughsomecompilerswould
issueawarningmessageifalocalfunctionwascalledwiththewrongnumberofarguments,orifmultiple
callstoanexternalfunctionuseddifferentnumbersortypesofarguments.SeparatetoolssuchasUnix'slint
utilityweredevelopedthat(amongotherthings)couldcheckforconsistencyoffunctionuseacrossmultiple
sourcefiles.
IntheyearsfollowingthepublicationofK&RC,severalfeatureswereaddedtothelanguage,supportedby
compilersfromAT&T(inparticularPCC[19])andsomeothervendors.Theseincluded:
voidfunctions(i.e.,functionswithnoreturnvalue)
functionsreturningstructoruniontypes(ratherthanpointers)
assignmentforstructdatatypes

enumeratedtypes
Thelargenumberofextensionsandlackofagreementonastandardlibrary,togetherwiththelanguage
popularityandthefactthatnoteventheUnixcompilerspreciselyimplementedtheK&Rspecification,led
tothenecessityofstandardization.

ANSICandISOC

Mainarticle:ANSIC
Duringthelate1970sand1980s,versionsofCwereimplementedforawidevarietyofmainframe
computers,minicomputers,andmicrocomputers,includingtheIBMPC,asitspopularitybegantoincrease
significantly.
In1983,theAmericanNationalStandardsInstitute(ANSI)formedacommittee,X3J11,toestablisha
standardspecificationofC.X3J11basedtheCstandardontheUniximplementationhowever,thenon
portableportionoftheUnixClibrarywashandedofftotheIEEEworkinggroup1003tobecomethebasis
forthe1988POSIXstandard.In1989,theCstandardwasratifiedasANSIX3.1591989"Programming
LanguageC".ThisversionofthelanguageisoftenreferredtoasANSIC,StandardC,orsometimesC89.
In1990,theANSICstandard(withformattingchanges)wasadoptedbytheInternationalOrganizationfor
Standardization(ISO)asISO/IEC9899:1990,whichissometimescalledC90.Therefore,theterms"C89"
and"C90"refertothesameprogramminglanguage.
ANSI,likeothernationalstandardsbodies,nolongerdevelopstheCstandardindependently,butdefersto
theinternationalCstandard,maintainedbytheworkinggroupISO/IECJTC1/SC22/WG14.National
adoptionofanupdatetotheinternationalstandardtypicallyoccurswithinayearofISOpublication.
OneoftheaimsoftheCstandardizationprocesswastoproduceasupersetofK&RC,incorporatingmany
ofthesubsequentlyintroducedunofficialfeatures.Thestandardscommitteealsoincludedseveraladditional
featuressuchasfunctionprototypes(borrowedfromC++),voidpointers,supportforinternationalcharacter
setsandlocales,andpreprocessorenhancements.Althoughthesyntaxforparameterdeclarationswas
augmentedtoincludethestyleusedinC++,theK&Rinterfacecontinuedtobepermitted,forcompatibility
withexistingsourcecode.
C89issupportedbycurrentCcompilers,andmostCcodebeingwrittentodayisbasedonit.Anyprogram
writtenonlyinStandardCandwithoutanyhardwaredependentassumptionswillruncorrectlyonany
platformwithaconformingCimplementation,withinitsresourcelimits.Withoutsuchprecautions,
programsmaycompileonlyonacertainplatformorwithaparticularcompiler,due,forexample,totheuse
ofnonstandardlibraries,suchasGUIlibraries,ortoarelianceoncompilerorplatformspecificattributes
suchastheexactsizeofdatatypesandbyteendianness.
IncaseswherecodemustbecompilablebyeitherstandardconformingorK&RCbasedcompilers,the
__STDC__macrocanbeusedtosplitthecodeintoStandardandK&RsectionstopreventtheuseonaK&R
CbasedcompileroffeaturesavailableonlyinStandardC.
AftertheANSI/ISOstandardizationprocess,theClanguagespecificationremainedrelativelystaticfor
severalyears.In1995NormativeAmendment1tothe1990Cstandard(ISO/IEC9899/AMD1:1995,
knowninformallyasC95)waspublished,tocorrectsomedetailsandtoaddmoreextensivesupportfor
internationalcharactersets.

C99
Mainarticle:C99

TheCstandardwasfurtherrevisedinthelate1990s,leadingtothepublicationofISO/IEC9899:1999in
1999,whichiscommonlyreferredtoas"C99".IthassincebeenamendedthreetimesbyTechnical
Corrigenda.[20]
C99introducedseveralnewfeatures,includinginlinefunctions,severalnewdatatypes(includinglong
longintandacomplextypetorepresentcomplexnumbers),variablelengtharraysandflexiblearray
members,improvedsupportforIEEE754floatingpoint,supportforvariadicmacros(macrosofvariable
arity),andsupportforonelinecommentsbeginningwith//,asinBCPLorC++.Manyofthesehad
alreadybeenimplementedasextensionsinseveralCcompilers.
C99isforthemostpartbackwardcompatiblewithC90,butisstricterinsomewaysinparticular,a
declarationthatlacksatypespecifiernolongerhasintimplicitlyassumed.Astandardmacro
__STDC_VERSION__isdefinedwithvalue199901LtoindicatethatC99supportisavailable.GCC,Solaris
Studio,andotherCcompilersnowsupportmanyorallofthenewfeaturesofC99.TheCcompilerin
MicrosoftVisualC++,however,implementstheC89standardandthosepartsofC99thatarerequiredfor
compatibilitywithC++11.[21]

C11
Mainarticle:C11(Cstandardrevision)
In2007,workbeganonanotherrevisionoftheCstandard,informallycalled"C1X"untilitsofficial
publicationon20111208.TheCstandardscommitteeadoptedguidelinestolimittheadoptionofnew
featuresthathadnotbeentestedbyexistingimplementations.
TheC11standardaddsnumerousnewfeaturestoCandthelibrary,includingtypegenericmacros,
anonymousstructures,improvedUnicodesupport,atomicoperations,multithreading,andboundschecked
functions.ItalsomakessomeportionsoftheexistingC99libraryoptional,andimprovescompatibilitywith
C++.

EmbeddedC
Mainarticle:EmbeddedC
Historically,embeddedCprogrammingrequiresnonstandardextensionstotheClanguageinorderto
supportexoticfeaturessuchasfixedpointarithmetic,multipledistinctmemorybanks,andbasicI/O
operations.
In2008,theCStandardsCommitteepublishedatechnicalreportextendingtheClanguage[22]toaddress
theseissuesbyprovidingacommonstandardforallimplementationstoadhereto.Itincludesanumberof
featuresnotavailableinnormalC,suchasfixedpointarithmetic,namedaddressspaces,andbasicI/O
hardwareaddressing.

Syntax
Mainarticle:Csyntax

ChasaformalgrammarspecifiedbytheCstandard.[23]UnlikelanguagessuchasFORTRAN77,Csource
codeisfreeformwhichallowsarbitraryuseofwhitespacetoformatcode,ratherthancolumnbasedor
textlinebasedrestrictions.Commentsmayappeareitherbetweenthedelimiters/*and*/,or(sinceC99)
following//untiltheendoftheline.Commentsdelimitedby/*and*/donotnest,andthesesequencesof
charactersarenotinterpretedascommentdelimitersiftheyappearinsidestringorcharacterliterals.[24]
Csourcefilescontaindeclarationsandfunctiondefinitions.Functiondefinitions,inturn,contain
declarationsandstatements.Declarationseitherdefinenewtypesusingkeywordssuchasstruct,union,
andenum,orassigntypestoandperhapsreservestoragefornewvariables,usuallybywritingthetype
followedbythevariablename.Keywordssuchascharandintspecifybuiltintypes.Sectionsofcodeare
enclosedinbraces({and},sometimescalled"curlybrackets")tolimitthescopeofdeclarationsandtoact
asasinglestatementforcontrolstructures.
Asanimperativelanguage,Cusesstatementstospecifyactions.Themostcommonstatementisan
expressionstatement,consistingofanexpressiontobeevaluated,followedbyasemicolonasasideeffect
oftheevaluation,functionsmaybecalledandvariablesmaybeassignednewvalues.Tomodifythenormal
sequentialexecutionofstatements,Cprovidesseveralcontrolflowstatementsidentifiedbyreserved
keywords.Structuredprogrammingissupportedbyif(else)conditionalexecutionandbydowhile,while,
andforiterativeexecution(looping).Theforstatementhasseparateinitialization,testing,and
reinitializationexpressions,anyorallofwhichcanbeomitted.breakandcontinuecanbeusedtoleavethe
innermostenclosingloopstatementorskiptoitsreinitialization.Thereisalsoanonstructuredgoto
statementwhichbranchesdirectlytothedesignatedlabelwithinthefunction.switchselectsacasetobe
executedbasedonthevalueofanintegerexpression.
Expressionscanuseavarietyofbuiltinoperatorsandmaycontainfunctioncalls.Theorderinwhich
argumentstofunctionsandoperandstomostoperatorsareevaluatedisunspecified.Theevaluationsmay
evenbeinterleaved.However,allsideeffects(includingstoragetovariables)willoccurbeforethenext
"sequencepoint"sequencepointsincludetheendofeachexpressionstatement,andtheentrytoandreturn
fromeachfunctioncall.Sequencepointsalsooccurduringevaluationofexpressionscontainingcertain
operators(&&,||,?:andthecommaoperator).Thispermitsahighdegreeofobjectcodeoptimizationby
thecompiler,butrequiresCprogrammerstotakemorecaretoobtainreliableresultsthanisneededfor
otherprogramminglanguages.
KernighanandRitchiesayintheIntroductionofTheCProgrammingLanguage:"C,likeanyother
language,hasitsblemishes.Someoftheoperatorshavethewrongprecedencesomepartsofthesyntax
couldbebetter."[25]TheCstandarddidnotattempttocorrectmanyoftheseblemishes,becauseofthe
impactofsuchchangesonalreadyexistingsoftware.

Characterset
ThebasicCsourcecharactersetincludesthefollowingcharacters:
Lowercaseanduppercaseletters:azAZ
Decimaldigits:09
Graphiccharacters:!"#%&'()*+,./:;<=>?[\]^_{|}~
Whitespacecharacters:space,horizontaltab,verticaltab,formfeed,newline

Newlineindicatestheendofatextlineitneednotcorrespondtoanactualsinglecharacter,althoughfor
convenienceCtreatsitasone.
Additionalmultibyteencodedcharactersmaybeusedinstringliterals,buttheyarenotentirelyportable.
ThelatestCstandard(C11)allowsmultinationalUnicodecharacterstobeembeddedportablywithinC
sourcetextbyusing\uXXXXor\UXXXXXXXXencoding(wheretheXdenotesahexadecimalcharacter),
althoughthisfeatureisnotyetwidelyimplemented.
ThebasicCexecutioncharactersetcontainsthesamecharacters,alongwithrepresentationsforalert,
backspace,andcarriagereturn.Runtimesupportforextendedcharactersetshasincreasedwitheach
revisionoftheCstandard.

Keywords
C89has32keywords(reservedwordswithspecialmeaning):
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

C99addsfivemorekeywords:
_Bool
_Complex

_Imaginary
inline

restrict

C11addssevenmorekeywords:[26]
_Alignas
_Alignof

_Atomic
_Generic

_Noreturn
_Static_assert

_Thread_local

Mostoftherecentlyaddedkeywordsbeginwithanunderscorefollowedbyacapitalletter,because
identifiersofthatformwerepreviouslyreservedbytheCstandardforuseonlybyimplementations.Since
existingprogramsourcecodeshouldnothavebeenusingtheseidentifiers,itwouldnotbeaffectedwhenC
implementationsstartedsupportingtheseextensionstotheprogramminglanguage.Somestandardheaders
dodefinemoreconvenientsynonymsforunderscoredidentifiers.Thelanguagepreviouslyincludeda
reservedkeywordcalledentry,butthiswasneverimplemented,andhasnowbeenremovedasareserved
word.[27]

Operators
Mainarticle:OperatorsinCandC++
Csupportsarichsetofoperators,whicharesymbolsusedwithinanexpressiontospecifythe
manipulationstobeperformedwhileevaluatingthatexpression.Chasoperatorsfor:
arithmetic:+,,*,/,%
assignment:=
augmentedassignment:+=,=,*=,/=,%=,&=,|=,^=,<<=,>>=
bitwiselogic:~,&,|,^
bitwiseshifts:<<,>>
booleanlogic:!,&&,||
conditionalevaluation:?:
equalitytesting:==,!=
callingfunctions:()
incrementanddecrement:++,
memberselection:.,>
objectsize:sizeof
orderrelations:<,<=,>,>=
referenceanddereference:&,*,[]
sequencing:,
subexpressiongrouping:()
typeconversion:(typename)
Cusesthe=operator,reservedinmathematicstoexpressequality,toindicateassignment,followingthe
precedentofFortranandPL/I,butunlikeALGOLanditsderivatives.ThesimilaritybetweenC'soperator
forassignmentandthatforequality(==)hasbeencriticizedasitmakesiteasytoaccidentallysubstituteone
fortheother.Inmanycases,eachmaybeusedinthecontextoftheotherwithoutacompilationerror
(althoughsomecompilersproducewarnings).Forexample,theconditionalexpressioninif(a=b+1)istrue
ifaisnotzeroaftertheassignment.[28]Additionally,C'soperatorprecedenceisnonintuitive,suchas==
bindingmoretightlythan&and|inexpressionslikex&1==0,whichwouldneedtobewritten(x&1)
==0tobeproperlyevaluated.[29]

"Hello,world"example
The"hello,world"example,whichappearedinthefirsteditionofK&R,hasbecomethemodelforan
introductoryprograminmostprogrammingtextbooks,regardlessofprogramminglanguage.Theprogram
prints"hello,world"tothestandardoutput,whichisusuallyaterminalorscreendisplay.
Theoriginalversionwas:[30]
main()
{
printf("hello,world\n");
}

Astandardconforming"hello,world"programis:[a]

#include<stdio.h>
intmain(void)
{
printf("hello,world\n");
}

Thefirstlineoftheprogramcontainsapreprocessingdirective,indicatedby#include.Thiscausesthe
compilertoreplacethatlinewiththeentiretextofthestdio.hstandardheader,whichcontainsdeclarations
forstandardinputandoutputfunctionssuchasprintf.Theanglebracketssurroundingstdio.hindicate
thatstdio.hislocatedusingasearchstrategythatprefersheadersinthecompiler'sincludepathtoother
headershavingthesamenamedoublequotesareusedtoincludelocalorprojectspecificheaderfiles.
Thenextlineindicatesthatafunctionnamedmainisbeingdefined.Themainfunctionservesaspecial
purposeinCprogramstheruntimeenvironmentcallsthemainfunctiontobeginprogramexecution.The
typespecifierintindicatesthatthevaluethatisreturnedtotheinvoker(inthiscasetheruntime
environment)asaresultofevaluatingthemainfunction,isaninteger.Thekeywordvoidasaparameterlist
indicatesthatthisfunctiontakesnoarguments.[b]
Theopeningcurlybraceindicatesthebeginningofthedefinitionofthemainfunction.
Thenextlinecalls(divertsexecutionto)afunctionnamedprintf,whichissuppliedfromasystemlibrary.
Inthiscall,theprintffunctionispassed(providedwith)asingleargument,theaddressofthefirst
characterinthestringliteral"hello,world\n".Thestringliteralisanunnamedarraywithelementsoftype
char,setupautomaticallybythecompilerwithafinal0valuedcharactertomarktheendofthearray
(printfneedstoknowthis).The\nisanescapesequencethatCtranslatestoanewlinecharacter,whichon
outputsignifiestheendofthecurrentline.Thereturnvalueoftheprintffunctionisoftypeint,butitis
silentlydiscardedsinceitisnotused.(Amorecarefulprogrammighttestthereturnvaluetodetermine
whetherornottheprintffunctionsucceeded.)Thesemicolon;terminatesthestatement.
Theclosingcurlybraceindicatestheendofthecodeforthemainfunction.AccordingtotheC99
specificationandnewer,themainfunction,unlikeanyotherfunction,willimplicitlyreturnastatusof0
uponreachingthe}thatterminatesthefunction.Thisisinterpretedbytheruntimesystemasanexitcode
indicatingsuccessfulexecution.[31]

Datatypes
Mainarticle:Cvariabletypesanddeclarations
ThetypesysteminCisstaticandweaklytyped,whichmakesitsimilartothetypesystemofALGOL
descendantssuchasPascal,althoughCisunrelatedtoALGOL.[32]Therearebuiltintypesforintegersof
varioussizes,bothsignedandunsigned,floatingpointnumbers,characters,andenumeratedtypes(enum).
C99addedabooleandatatype.Therearealsoderivedtypesincludingarrays,pointers,records(struct),and
untaggedunions(union).

Cisoftenusedinlowlevelsystemsprogrammingwhereescapesfromthetypesystemmaybenecessary.
Thecompilerattemptstoensuretypecorrectnessofmostexpressions,buttheprogrammercanoverridethe
checksinvariousways,eitherbyusingatypecasttoexplicitlyconvertavaluefromonetypetoanother,or
byusingpointersorunionstoreinterprettheunderlyingbitsofadataobjectinsomeotherway.
SomefindC'sdeclarationsyntaxunintuitive,particularlyforfunctionpointers.(Ritchie'sideawasto
declareidentifiersincontextsresemblingtheiruse:"declarationreflectsuse".)[33]
C'susualarithmeticconversionsallowforefficientcodetobegenerated,butcansometimesproduce
unexpectedresults.Forexample,acomparisonofsignedandunsignedintegersofequalwidthrequiresa
conversionofthesignedvaluetounsigned.Thiscangenerateunexpectedresultsifthesignedvalueis
negative.

Pointers
Csupportstheuseofpointers,atypeofreferencethatrecordstheaddressorlocationofanobjector
functioninmemory.Pointerscanbedereferencedtoaccessdatastoredattheaddresspointedto,orto
invokeapointedtofunction.Pointerscanbemanipulatedusingassignmentorpointerarithmetic.Therun
timerepresentationofapointervalueistypicallyarawmemoryaddress(perhapsaugmentedbyanoffset
withinwordfield),butsinceapointer'stypeincludesthetypeofthethingpointedto,expressionsincluding
pointerscanbetypecheckedatcompiletime.Pointerarithmeticisautomaticallyscaledbythesizeofthe
pointedtodatatype.PointersareusedformanypurposesinC.Textstringsarecommonlymanipulated
usingpointersintoarraysofcharacters.Dynamicmemoryallocationisperformedusingpointers.Many
datatypes,suchastrees,arecommonlyimplementedasdynamicallyallocatedstructobjectslinked
togetherusingpointers.Pointerstofunctionsareusefulforpassingfunctionsasargumentstohigherorder
functions(suchasqsortorbsearch)orascallbackstobeinvokedbyeventhandlers.[31]
Anullpointervalueexplicitlypointstonovalidlocation.Dereferencinganullpointervalueisundefined,
oftenresultinginasegmentationfault.Nullpointervaluesareusefulforindicatingspecialcasessuchasno
"next"pointerinthefinalnodeofalinkedlist,orasanerrorindicationfromfunctionsreturningpointers.
Inappropriatecontextsinsourcecode,suchasforassigningtoapointervariable,anullpointerconstant
canbewrittenas0,withorwithoutexplicitcastingtoapointertype,orastheNULLmacrodefinedby
severalstandardheaders.Inconditionalcontexts,nullpointervaluesevaluatetofalse,whileallother
pointervaluesevaluatetotrue.
Voidpointers(void*)pointtoobjectsofunspecifiedtype,andcanthereforebeusedas"generic"data
pointers.Sincethesizeandtypeofthepointedtoobjectisnotknown,voidpointerscannotbe
dereferenced,norispointerarithmeticonthemallowed,althoughtheycaneasilybe(andinmanycontexts
implicitlyare)convertedtoandfromanyotherobjectpointertype.[31]
Carelessuseofpointersispotentiallydangerous.Becausetheyaretypicallyunchecked,apointervariable
canbemadetopointtoanyarbitrarylocation,whichcancauseundesirableeffects.Althoughproperlyused
pointerspointtosafeplaces,theycanbemadetopointtounsafeplacesbyusinginvalidpointerarithmetic
theobjectstheypointtomaybedeallocatedandreused(danglingpointers)theymaybeusedwithout
havingbeeninitialized(wildpointers)ortheymaybedirectlyassignedanunsafevalueusingacast,union,
orthroughanothercorruptpointer.Ingeneral,Cispermissiveinallowingmanipulationofandconversion
betweenpointertypes,althoughcompilerstypicallyprovideoptionsforvariouslevelsofchecking.Some
otherprogramminglanguagesaddresstheseproblemsbyusingmorerestrictivereferencetypes.

Arrays
Seealso:Cstring
ArraytypesinCaretraditionallyofafixed,staticsizespecifiedatcompiletime.(ThemorerecentC99
standardalsoallowsaformofvariablelengtharrays.)However,itisalsopossibletoallocateablockof
memory(ofarbitrarysize)atruntime,usingthestandardlibrary'smallocfunction,andtreatitasanarray.
C'sunificationofarraysandpointersmeansthatdeclaredarraysandthesedynamicallyallocatedsimulated
arraysarevirtuallyinterchangeable.
Sincearraysarealwaysaccessed(ineffect)viapointers,arrayaccessesaretypicallynotcheckedagainst
theunderlyingarraysize,althoughsomecompilersmayprovideboundscheckingasanoption.[34]Array
boundsviolationsarethereforepossibleandrathercommonincarelesslywrittencode,andcanleadto
variousrepercussions,includingillegalmemoryaccesses,corruptionofdata,bufferoverruns,andruntime
exceptions.Ifboundscheckingisdesired,itmustbedonemanually.
Cdoesnothaveaspecialprovisionfordeclaringmultidimensionalarrays,butratherreliesonrecursion
withinthetypesystemtodeclarearraysofarrays,whicheffectivelyaccomplishesthesamething.The
indexvaluesoftheresulting"multidimensionalarray"canbethoughtofasincreasinginrowmajororder.
Multidimensionalarraysarecommonlyusedinnumericalalgorithms(mainlyfromappliedlinearalgebra)
tostorematrices.ThestructureoftheCarrayiswellsuitedtothisparticulartask.However,sincearraysare
passedmerelyaspointers,theboundsofthearraymustbeknownfixedvaluesorelseexplicitlypassedto
anysubroutinethatrequiresthem,anddynamicallysizedarraysofarrayscannotbeaccessedusingdouble
indexing.(Aworkaroundforthisistoallocatethearraywithanadditional"rowvector"ofpointerstothe
columns.)
C99introduced"variablelengtharrays"whichaddresssome,butnotall,oftheissueswithordinaryC
arrays.

Arraypointerinterchangeability
Thesubscriptnotationx[i](wherexdesignatesapointer)isasyntacticsugarfor*(x+i).[35]Taking
advantageofthecompiler'sknowledgeofthepointertype,theaddressthatx+ipointstoisnotthebase
address(pointedtobyx)incrementedbyibytes,butratherisdefinedtobethebaseaddressincremented
byimultipliedbythesizeofanelementthatxpointsto.Thus,x[i]designatesthei+1thelementofthe
array.
Furthermore,inmostexpressioncontexts(anotableexceptionisasoperandofsizeof),thenameofan
arrayisautomaticallyconvertedtoapointertothearray'sfirstelement.Thisimpliesthatanarrayisnever
copiedasawholewhennamedasanargumenttoafunction,butratheronlytheaddressofitsfirstelement
ispassed.Therefore,althoughfunctioncallsinCusepassbyvaluesemantics,arraysareineffectpassed
byreference.
Thesizeofanelementcanbedeterminedbyapplyingtheoperatorsizeoftoanydereferencedelementofx,
asinn=sizeof*xorn=sizeofx[0],andthenumberofelementsinadeclaredarrayAcanbe
determinedassizeofA/sizeofA[0].Thelatteronlyappliestoarraynames:variablesdeclaredwith
subscripts(intA[20]).DuetothesemanticsofC,itisnotpossibletodeterminetheentiresizeofarrays

throughpointerstoarraysorthosecreatedbydynamicallocation(malloc)codesuchassizeofarr/
sizeofarr[0](wherearr=Adesignatesapointer)willnotworksincethecompilerassumesthesizeof
thepointeritselfisbeingrequested.[36][37]Sincearraynameargumentstosizeofarenotconvertedto
pointers,theydonotexhibitsuchambiguity.However,arrayscreatedbydynamicallocationareinitialized
topointersratherthantruearrayvariables,sotheysufferfromthesamesizeofissuesasarraypointers.
Thus,despitethisapparentequivalencebetweenarrayandpointervariables,thereisstilladistinctiontobe
madebetweenthem.Eventhoughthenameofanarrayis,inmostexpressioncontexts,convertedintoa
pointer(toitsfirstelement),thispointerdoesnotitselfoccupyanystoragethearraynameisnotanlvalue,
anditsaddressisaconstant,unlikeapointervariable.Consequently,whatanarray"pointsto"cannotbe
changed,anditisimpossibletoassignanewaddresstoanarrayname.Arraycontentsmaybecopied,
however,byusingthememcpyfunction,orbyaccessingtheindividualelements.

Memorymanagement
Oneofthemostimportantfunctionsofaprogramminglanguageistoprovidefacilitiesformanaging
memoryandtheobjectsthatarestoredinmemory.Cprovidesthreedistinctwaystoallocatememoryfor
objects:[31]
Staticmemoryallocation:spacefortheobjectisprovidedinthebinaryatcompiletimetheseobjects
haveanextent(orlifetime)aslongasthebinarywhichcontainsthemisloadedintomemory.
Automaticmemoryallocation:temporaryobjectscanbestoredonthestack,andthisspaceis
automaticallyfreedandreusableaftertheblockinwhichtheyaredeclaredisexited.
Dynamicmemoryallocation:blocksofmemoryofarbitrarysizecanberequestedatruntimeusing
libraryfunctionssuchasmallocfromaregionofmemorycalledtheheaptheseblockspersistuntil
subsequentlyfreedforreusebycallingthelibraryfunctionreallocorfree
Thesethreeapproachesareappropriateindifferentsituationsandhavevarioustradeoffs.Forexample,
staticmemoryallocationhaslittleallocationoverhead,automaticallocationmayinvolveslightlymore
overhead,anddynamicmemoryallocationcanpotentiallyhaveagreatdealofoverheadforbothallocation
anddeallocation.Thepersistentnatureofstaticobjectsisusefulformaintainingstateinformationacross
functioncalls,automaticallocationiseasytousebutstackspaceistypicallymuchmorelimitedand
transientthaneitherstaticmemoryorheapspace,anddynamicmemoryallocationallowsconvenient
allocationofobjectswhosesizeisknownonlyatruntime.MostCprogramsmakeextensiveuseofall
three.
Wherepossible,automaticorstaticallocationisusuallysimplestbecausethestorageismanagedbythe
compiler,freeingtheprogrammerofthepotentiallyerrorpronechoreofmanuallyallocatingandreleasing
storage.However,manydatastructurescanchangeinsizeatruntime,andsincestaticallocations(and
automaticallocationsbeforeC99)musthaveafixedsizeatcompiletime,therearemanysituationsin
whichdynamicallocationisnecessary.[31]PriortotheC99standard,variablesizedarrayswereacommon
exampleofthis.(Seethearticleonmallocforanexampleofdynamicallyallocatedarrays.)Unlike
automaticallocation,whichcanfailatruntimewithuncontrolledconsequences,thedynamicallocation
functionsreturnanindication(intheformofanullpointervalue)whentherequiredstoragecannotbe
allocated.(Staticallocationthatistoolargeisusuallydetectedbythelinkerorloader,beforetheprogram
canevenbeginexecution.)

Unlessotherwisespecified,staticobjectscontainzeroornullpointervaluesuponprogramstartup.
Automaticallyanddynamicallyallocatedobjectsareinitializedonlyifaninitialvalueisexplicitly
specifiedotherwisetheyinitiallyhaveindeterminatevalues(typically,whateverbitpatternhappenstobe
presentinthestorage,whichmightnotevenrepresentavalidvalueforthattype).Iftheprogramattempts
toaccessanuninitializedvalue,theresultsareundefined.Manymoderncompilerstrytodetectandwarn
aboutthisproblem,butbothfalsepositivesandfalsenegativescanoccur.
Anotherissueisthatheapmemoryallocationhastobesynchronizedwithitsactualusageinanyprogramin
orderforittobereusedasmuchaspossible.Forexample,iftheonlypointertoaheapmemoryallocation
goesoutofscopeorhasitsvalueoverwrittenbeforefree()iscalled,thenthatmemorycannotberecovered
forlaterreuseandisessentiallylosttotheprogram,aphenomenonknownasamemoryleak.Conversely,it
ispossibleformemorytobefreedbutcontinuetobereferenced,leadingtounpredictableresults.Typically,
thesymptomswillappearinaportionoftheprogramfarremovedfromtheactualerror,makingitdifficult
totrackdowntheproblem.(Suchissuesareamelioratedinlanguageswithautomaticgarbagecollection.)

Libraries
TheCprogramminglanguageuseslibrariesasitsprimarymethodofextension.InC,alibraryisasetof
functionscontainedwithinasingle"archive"file.Eachlibrarytypicallyhasaheaderfile,whichcontains
theprototypesofthefunctionscontainedwithinthelibrarythatmaybeusedbyaprogram,anddeclarations
ofspecialdatatypesandmacrosymbolsusedwiththesefunctions.Inorderforaprogramtousealibrary,it
mustincludethelibrary'sheaderfile,andthelibrarymustbelinkedwiththeprogram,whichinmanycases
requirescompilerflags(e.g.,lm,shorthandfor"mathlibrary").[31]
ThemostcommonClibraryistheCstandardlibrary,whichisspecifiedbytheISOandANSICstandards
andcomeswitheveryCimplementation.(Implementationswhichtargetlimitedenvironmentssuchas
embeddedsystemsmayprovideonlyasubsetofthestandardlibrary.)Thislibrarysupportsstreaminput
andoutput,memoryallocation,mathematics,characterstrings,andtimevalues.Severalseparatestandard
headers(forexample,stdio.h)specifytheinterfacesfortheseandotherstandardlibraryfacilities.
AnothercommonsetofClibraryfunctionsarethoseusedbyapplicationsspecificallytargetedforUnixand
Unixlikesystems,especiallyfunctionswhichprovideaninterfacetothekernel.Thesefunctionsare
detailedinvariousstandardssuchasPOSIXandtheSingleUNIXSpecification.
SincemanyprogramshavebeenwritteninC,thereareawidevarietyofotherlibrariesavailable.Libraries
areoftenwritteninCbecauseCcompilersgenerateefficientobjectcodeprogrammersthencreate
interfacestothelibrarysothattheroutinescanbeusedfromhigherlevellanguageslikeJava,Perl,and
Python.[31]

Languagetools
ToolshavebeencreatedtohelpCprogrammersavoidsomeoftheproblemsinherentinthelanguage,such
asstatementswithundefinedbehaviororstatementsthatarenotagoodpracticebecausetheyarelikelyto
resultinunintendedbehaviororruntimeerrors.

Automatedsourcecodecheckingandauditingarebeneficialinanylanguage,andforCmanysuchtools
exist,suchasLint.AcommonpracticeistouseLinttodetectquestionablecodewhenaprogramisfirst
written.OnceaprogrampassesLint,itisthencompiledusingtheCcompiler.Also,manycompilerscan
optionallywarnaboutsyntacticallyvalidconstructsthatarelikelytoactuallybeerrors.MISRACisa
proprietarysetofguidelinestoavoidsuchquestionablecode,developedforembeddedsystems.[38]
Therearealsocompilers,libraries,andoperatingsystemlevelmechanismsforperformingactionsthatare
notastandardpartofC,suchasarrayboundschecking,bufferoverflowdetection,serialization,and
automaticgarbagecollection.
ToolssuchasPurifyorValgrindandlinkingwithlibrariescontainingspecialversionsofthememory
allocationfunctionscanhelpuncoverruntimeerrorsinmemoryusage.

Uses
Ciswidelyusedfor"system
programming",including
implementingoperatingsystemsand
embeddedsystemapplications,due
toacombinationofdesirable
characteristicssuchascode
portabilityandefficiency,abilityto
accessspecifichardwareaddresses,
abilitytopuntypestomatch
externallyimposeddataaccess
requirements,andlowruntime
demandonsystemresources.Ccan
alsobeusedforwebsite
programmingusingCGIasa
"gateway"forinformationbetween
theWebapplication,theserver,and
thebrowser.[40]Somereasonsfor
choosingCoverinterpreted
languagesareitsspeed,stability,and
nearuniversalavailability.[41]

TheTIOBEindexgraphfrom2002to2015,showingacomparisonof
thepopularityofvariousprogramminglanguages[39]

OneconsequenceofC'swide
availabilityandefficiencyisthat
compilers,libraries,andinterpretersofotherprogramminglanguagesareoftenimplementedinC.The
primaryimplementationsofPython(CPython),Perl5,andPHPareallwritteninC.
Duetoitsthinlayerofabstractionandlowoverhead,Callowsefficientimplementationsofalgorithmsand
datastructures,whichisusefulforprogramsthatperformalotofcomputations.Forexample,theGNU
MultiplePrecisionArithmeticLibrary,theGNUScientificLibrary,MathematicaandMATLABare
completelyorpartiallywritteninC.

Cissometimesusedasanintermediatelanguagebyimplementationsofotherlanguages.Thisapproach
maybeusedforportabilityorconveniencebyusingCasanintermediatelanguage,itisnotnecessaryto
developmachinespecificcodegenerators.Chassomefeatures,suchaslinenumberpreprocessor
directivesandoptionalsuperfluouscommasattheendofinitializerlists,whichsupportcompilationof
generatedcode.However,someofC'sshortcomingshavepromptedthedevelopmentofotherCbased
languagesspecificallydesignedforuseasintermediatelanguages,suchasC.
Chasalsobeenwidelyusedtoimplementenduserapplications,butmuchofthatdevelopmenthasshifted
tonewer,higherlevellanguages.

Relatedlanguages
ChasdirectlyorindirectlyinfluencedmanylaterlanguagessuchasC#,D,Go,Java,JavaScript,Limbo,
LPC,Perl,PHP,Python,andUnix'sCshell.Themostpervasiveinfluencehasbeensyntactical:allofthe
languagesmentionedcombinethestatementand(moreorlessrecognizably)expressionsyntaxofCwith
typesystems,datamodelsand/orlargescaleprogramstructuresthatdifferfromthoseofC,sometimes
radically.
SeveralCornearCinterpretersexist,includingChandCINT,whichcanalsobeusedforscripting.
Whenobjectorientedlanguagesbecamepopular,C++andObjectiveCweretwodifferentextensionsofC
thatprovidedobjectorientedcapabilities.Bothlanguageswereoriginallyimplementedassourcetosource
compilerssourcecodewastranslatedintoC,andthencompiledwithaCcompiler.
TheC++programminglanguagewasdevisedbyBjarneStroustrupasanapproachtoprovidingobject
orientedfunctionalitywithaClikesyntax.[42]C++addsgreatertypingstrength,scoping,andothertools
usefulinobjectorientedprogramming,andpermitsgenericprogrammingviatemplates.Nearlyasuperset
ofC,C++nowsupportsmostofC,withafewexceptions.
ObjectiveCwasoriginallyavery"thin"layerontopofC,andremainsastrictsupersetofCthatpermits
objectorientedprogrammingusingahybriddynamic/statictypingparadigm.ObjectiveCderivesitssyntax
frombothCandSmalltalk:syntaxthatinvolvespreprocessing,expressions,functiondeclarations,and
functioncallsisinheritedfromC,whilethesyntaxforobjectorientedfeatureswasoriginallytakenfrom
Smalltalk.
InadditiontoC++andObjectiveC,Ch,CilkandUnifiedParallelCarenearlysupersetsofC.

Seealso
ComparisonofPascalandC
Comparisonofprogramminglanguages
InternationalObfuscatedCCodeContest
ListofCbasedprogramminglanguages
ListofCcompilers

Notes

a. Theoriginalexamplecodewillcompileonmostmoderncompilersthatarenotinstrictstandardcompliance
mode,butitdoesnotfullyconformtotherequirementsofeitherC89orC99.Infact,C99requiresthata
diagnosticmessagebeproduced.
b. Themainfunctionactuallyhastwoarguments,intargcandchar*argv[],respectively,whichcanbeusedto
handlecommandlinearguments.TheISOCstandard(section5.1.2.2.1)requiresbothformsofmaintobe
supported,whichisspecialtreatmentnotaffordedtoanyotherfunction.

References
1. Kernighan,BrianW.Ritchie,DennisM.(February1978).TheCProgrammingLanguage(1sted.).Englewood
Cliffs,NJ:PrenticeHall.ISBN0131101633.RegardedbymanytobetheauthoritativereferenceonC.
2. Ritchie(1993):"ThompsonhadmadeabriefattempttoproduceasystemcodedinanearlyversionofCbefore
structuresin1972,butgaveuptheeffort."
3. Ritchie(1993):"TheschemeoftypecompositionadoptedbyCowesconsiderabledebttoAlgol68,althoughit
didnot,perhaps,emergeinaformthatAlgol'sadherentswouldapproveof."
4. "VerilogHDL(andC)"(PDF).TheResearchSchoolofComputerScienceattheAustralianNationalUniversity.
20100603.Retrieved20130819."1980s:VerilogfirstintroducedVeriloginspiredbytheCprogramming
language"
5. Ritchie(1993)
6. Lawlis,PatriciaK.(August1997)."GuidelinesforChoosingaComputerLanguage:SupportfortheVisionary
Organization".AdaInformationClearinghouse.Retrieved18July2006.
7. "ProgrammingLanguagePopularity".2009.Retrieved16January2009.
8. "TIOBEProgrammingCommunityIndex".2009.Retrieved6May2009.
9. "MoreControlStructures"."IfyouknowtheCprogramminglanguage,theforstatementwillbefamiliartoyou.
TheforstatementinPerlissyntacticallyidenticaltotheforstatementinC."
10. "HandsOnEthicalHackingandNetworkDefense".
11. "CLanguageTutorial"."Withoutpointers,CwouldlookalmostidenticaltoPHP."
12. "HowEiffelStudioCompiles".docs.eiffel.com.Retrieved20150202.
13. "ExtendingPythonwithCorC++".docs.python.org.Retrieved20150202.
14. Ritchie,DennisM.(March1993)."TheDevelopmentoftheCLanguage".ACMSIGPLANNotices28(3):201
208.doi:10.1145/155360.155580.
15. Johnson,S.C.Ritchie,D.M.(1978)."PortabilityofCProgramsandtheUNIXSystem".BellSystemTech.J.
57(6):20212048.doi:10.1002/j.15387305.1978.tb02141.x.Retrieved16December2012.
16. McIlroy,M.D.(1987).AResearchUnixreader:annotatedexcerptsfromtheProgrammer'sManual,19711986
(PDF)(Technicalreport).CSTR.BellLabs.p.10.139.
17. Stallings,William."OperatingSystems:InternalsandDesignPrinciples"5thed,page91.PearsonEducation,
Inc.2005.
18. Kernighan,BrianW.Ritchie,DennisM.(March1988).TheCProgrammingLanguage(2nded.).Englewood
Cliffs,NJ:PrenticeHall.ISBN0131103628.
19. Stroustrup,Bjarne(2002).Siblingrivalry:CandC++(PDF)(Report)(TD54MQZY).AT&TLabs.
20. "JTC1/SC22/WG14C".Homepage.ISO/IEC.Retrieved2June2011.
21. AndrewBinstock(October12,2011)."InterviewwithHerbSutter".Dr.Dobbs.RetrievedSeptember7,2013.
22. "TR18037:EmbeddedC"(PDF).ISO/IEC.Retrieved26July2011.
23. Harbison,SamuelP.Steele,GuyL.(2002).C:AReferenceManual(5thed.).EnglewoodCliffs,NJ:Prentice
Hall.ISBN013089592X.ContainsaBNFgrammarforC.
24. Kernighan,BrianW.Ritchie,DennisM.(1996).TheCProgrammingLanguage(2nded.).PrenticeHall.
p.192.ISBN730202412X.
25. Page3oftheoriginalK&R[1]
26. ISO/IEC9899:201x(ISOC11)CommitteeDraft(http://www.openstd.org/jtc1/sc22/wg14/www/docs/n1548.pdf)
27. Kernighan,BrianW.Ritchie,DennisM.(1996).TheCProgrammingLanguage(2nded.).PrenticeHall.
pp.192,259.ISBN730202412X.
28. "10CommonProgrammingMistakesinC++".Cs.ucr.edu.Retrieved26June2009.

29. Schultz,Thomas(2004).Candthe8051(3rded.).Otsego,MI:PageFreePublishingInc.p.20.ISBN158961
237X.Retrieved10February2012.
30. Page6oftheoriginalK&R[1]
31. Klemens,Ben(2013).21stCenturyC.O'ReillyMedia.ISBN1449327141.
32. Feuer,AlanR.Gehani,NarainH.(March1982)."ComparisonoftheProgrammingLanguagesCandPascal".
ACMComputingSurveys14(1):7392.doi:10.1145/356869.356872.(subscriptionrequired(help)).
33. Page122ofK&R2[18]
34. Forexample,gccprovides_FORTIFY_SOURCE."SecurityFeatures:CompileTimeBufferChecks
(FORTIFY_SOURCE)".fedoraproject.org.Retrieved20120805.
35. Raymond,EricS.(11October1996).TheNewHacker'sDictionary(3rded.).MITPress.p.432.ISBN9780
262680929.Retrieved5August2012.
36. Summit,Steve."comp.lang.cFrequentlyAskedQuestions6.23".RetrievedMarch6,2013.
37. Summit,Steve."comp.lang.cFrequentlyAskedQuestions7.28".RetrievedMarch6,2013.
38. "ManPageforlint(freebsdSection1)".unix.com.20010524.Retrieved20140715.
39. McMillan,Robert(20130801)."IsJavaLosingItsMojo?".Wired.
40. Dr.Dobb'sSourcebook.U.S.A.:MillerFreeman,Inc.NovemberDecember1995.
41. "UsingCforCGIProgramming".linuxjournal.com.1March2005.Retrieved4January2010.
42. Stroustrup,Bjarne(1993)."AHistoryofC++:19791991"(PDF).Retrieved9June2011.
Ritchie,DennisM.(1993).TheDevelopmentoftheCLanguage.ThesecondACMSIGPLANHistoryof
ProgrammingLanguagesConference(HOPLII)(Cambridge,MA,USAApril2023,1993:ACM):201
208.doi:10.1145/154766.155580.ISBN0897915704.Retrieved20141104.

Furtherreading
Banahan,M.Brady,D.Doran,M.(1991).TheCBook(2nded.).AddisonWesley.
King,K.N.(April2008).CProgramming:AModernApproach(2nded.).Norton.ISBN9780393
979503.
Thompson,Ken."ANewCCompiler"(PDF).MurrayHill,NewJersey:AT&TBellLaboratories.
Feuer,AlanR.(1998).TheCPuzzleBook(1st,revisedprintinged.).AddisonWesley.ISBN9780
201604610.

Externallinks
ISOCWorkingGroupofficialwebsite(http://www.openstd.org/jtc1/sc22/wg14/)
comp.lang.cFrequentlyAskedQuestions(http://www.cfaq.com/)
ISO/IEC9899(http://www.openstd.org/JTC1/SC22/WG14/www/standards),officialC99documents
ANSICStandard(ANSIX3J11/88090)(http://flashgordon.me.uk/ansi.c.txt)(publishedon13May
1988),ThirdPublicReview(http://groups.google.com/group/comp.lang.c/msg/20b174b18cdd919d?
hl=en)
ANSICRationale(ANSIX3J11/88151)(http://www.scribd.com/doc/16306895/DraftANSIC
Rationale)(publishedon18November1988)
C99withTechnicalcorrigendaTC1,TC2,andTC3included(http://www.open
std.org/JTC1/SC22/WG14/www/docs/n1256.pdf)PDF(3.61MB)
AHistoryofC(http://web.archive.org/web/20040202065522/http://cm.bell
labs.com/cm/cs/who/dmr/chist.html),byDennisRichie,archivedfromtheoriginalonFebruary2,
2004
Retrievedfrom"https://en.wikipedia.org/w/index.php?

title=C_(programming_language)&oldid=682975499"
Categories: Americaninventions C(programminglanguage) Cprogramminglanguagefamily
Crossplatformsoftware Lowlevelprogramminglanguages Proceduralprogramminglanguages
Programminglanguagescreatedin1972 ProgramminglanguageswithanISOstandard
Staticallytypedprogramminglanguages Systemsprogramminglanguages
Thispagewaslastmodifiedon27September2015,at08:38.
TextisavailableundertheCreativeCommonsAttributionShareAlikeLicenseadditionaltermsmay
apply.Byusingthissite,youagreetotheTermsofUseandPrivacyPolicy.Wikipediaisa
registeredtrademarkoftheWikimediaFoundation,Inc.,anonprofitorganization.

You might also like