keywords and identifiers in C programming

Page 1

LearnCProgramming

Keywords&Identifiers

Inthistutorial,youwilllearnaboutkeywordsandidentifiers.Keywordswhichare reservedwordsintheCprogramminglanguageandessentialpartsofitssyntax. Additionally,youwilllearnaboutidentifiersandtheprocessofnamingthem.Keywords andidentifiersarebothintegralfordefiningsyntax,semantics,andprecise communicationinCprogramming.

Keywords

KeywordsinCprogrammingrepresentreservedwordswithpredefinedmeanings.These wordscannotbeutilizedasidentifiers,suchasvariablenamesorfunctionnames. Thesekeywordsarepartofthelanguage’ssyntaxandservespecificpurposesinthe code.SomeexamplesofkeywordsinCprogramminginclude“if,”“else,”“for,”“while,” “int,”“float,”“return,”and“switch.”Thesekeywordsarecrucialfordefiningcontrol structures,datatypes,andotherfundamentalaspectsofCprogramming.

Forinstance:

Moneyisavariableoftypeint,asindicatedbythekeyword“int”inthissentence (integer).

In C programming, itisimportanttotypeallkeywordsinlowercasebecauseCisacasesensitivelanguage.

Identifiers  TUTORIALS  EXAMPLES
PROJECTS
ONLINECOMPILER GetStarted  FlowControl  Functions  Arrays  Pointers  Strings  StructureAndUnion  FileHandling  Enumeration  Preprocessor  intmoney intmoney; ; Search 

InCprogramming,Identifierreferstonamegiventovariousprogramelementssuchas variables,functions,arraysetc.Thesenamesenabletheidentificationandreferencing oftheseprogramelementswithinthecode.

Itisgoodpracticetochoosemeaningfulanddescriptivenamesforidentifiers,making thecodemorereadableandunderstandable.

For instance

intschool intschool; ; doublestudents doublestudents; ;

Here,wecanidentify“school”and“students”asidentifiers.

Also,keepinmindthatidentifiernamesandkeywordsmustbedistinct.Sinceintisa keyword,youcannotuseintasanidentifier

Rulesfornamingidentifiers

1.Theycanconsistofletters(bothuppercaseandlowercase),digits,andunderscores.

2.Thefirstcharacterofanidentifiermustbealetteroranunderscore.

3.TheyshouldnotbeakeywordorareservedwordinC.

4.IdentifiersinCprogrammingtreatuppercaseandlowercaselettersasdistinct, whichmeanstheyarecase-sensitive.

Identifiersmustbedistinct,astheyservethepurposeofprovidingauniquenametoan entitythatfacilitatesitsidentificationduringtheexecutionofanapplication.

10/10OVERALLRATING      Tutorials Practice Company Our latest news, articles, and resources, we will sent to your inbox weekly Enter your email Subscribe CProgramming CExamples CProjects CQuiz AboutUs PrivacyPolicy Contact WebStories Blog ©2023CcodelearnerPoweredby Esos Technologies    

Turn static files into dynamic content formats.

Create a flipbook
Issuu converts static files into: digital portfolios, online yearbooks, online catalogs, digital photo albums and more. Sign up and create your flipbook.