basic syntax of the C programming language

Page 1

LearnCProgramming

Syntax

WelcometoCcodelearner, Inthistutorial,youwilllearnaboutthebasicsyntaxoftheCprogramming language.

Firstandforemost,it’simportanttoknowthatDennisRitchiedevelopedthe C programming language atAT&T’sBellLaboratoriesintheUSAin1972.

Moreover,Cisageneral-purpose,proceduralcomputerprogramminglanguagethat supportsstructuredprogramming,lexicalvariablescope,recursion,andastatictype systemwiththehelpofsyntaxCprogrammingtutorials.Asaproceduralprogramming language,Cemphasizestheexecutionofproceduresorfunctionsinaspecificorder TobeginprogramminginC,thereareafewessentialrequirementsinC syntax:

1.Atexteditor:ThiscouldbeabasicprogramlikeNotepadoramorefeature-richone likeVisualStudioCode.

2.ACcompiler:ThissoftwarewilltransformyourCcodeintoanexecutableprogram. PopularcompilersincludeGCCandClang.

Onceyouhaveobtainedthesenecessarycomponents,youcanbeginwritingCcodein yourtexteditor.Subsequently,youcanutilizeyourcompilertotransformitintoan executableprogram.

QuickstartGuide(syntaxinprogramming):

OurtutorialwillmakeuseofCode::Blocks,whichwebelieveisagoodplacetostart. YoucanfindthemostrecentversionofCodeblocksat https://www codeblocks org/.

Downloadthefilemingw-setup.exetosetupthetexteditorwithacompiler

 TUTORIALS  EXAMPLES  PROJECTS  ONLINECOMPILER GetStarted  FlowControl  Functions  Arrays  Pointers  Strings  StructureAndUnion  FileHandling  Enumeration  Preprocessor  Search  Welcome to Ccodelearner Ccodelearner asks for your consent to use your personal data to:  Personalisedads andcontent adandcontent measurement audience insights andproduct development  Store and/or access information on a device  Learn more Your personal data will be processed and informationfrom your device (cookies unique identiers and other device data) may be stored by accessed by and shared with third party vendors, or used specically by this site or app Some vendors may process your personal data onthe basis of legitimate interest whichyoucanobject to by managing your options below Look for a link at the bottom of this page or inour privacy policy where youcan withdraw consent  Manage options Consent Do not consent

Nowlet’sproceedtocreatingourfirstCfile:

InCodeblocks,navigatetoFile>New>EmptyFile.Then,copyandpastethe followingCcodeintothefilenamedMyFirstProgram.candsaveitaccordinglyusingFile >SaveFileas:MyFirstProgram.c.

#include #include<<stdiostdiohh> > int intmainmain(()){ { printf printf((“Hello“Hello,WorldWorld!!””)); ; return return00; ; } }

Don’tworryifyoudon’tunderstandthecodeabove,Insubsequentchapters,we’llgo depthintoitlikesyntaxhtml,pythonsyntax,javasyntaxandsoon.Fornow,focuson howtoexecutethecode.

In Codeblocks, itshouldlookliketheprovidedscreenshot.

Welcome to Ccodelearner Ccodelearner asks for your consent to use your personal data to:

 Personalisedads andcontent adandcontent measurement audience insights andproduct development

 Store and/or access information on a device

Torun(execute)theprogram,selectBuild>BuildandRun.Theoutcomewilldisplay “Hello,World!”intheoutput.Additionally,youwillseetheprocessreturnvalueand executiontime.

Output

HelloWorld!

Processreturned0(0x0)executiontime:0.011s Processreturned0(0x0)executiontime:0.011s Pressanykeytocontinue. Pressanykeytocontinue.

CongratulationsonsuccessfullywritingandexecutingyourfirstCprogram!

personal data will be processed and informationfrom your device (cookies unique identiers and other device data) may be stored by accessed by and shared with third party vendors, or used specically by this site or app
vendors may process your personal data onthe basis of legitimate interest whichyoucanobject to
managing your options below Look
link at the bottom of this page or inour privacy policy where youcan
Your
Some
by
for a
withdraw consent
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 ©2023Ccodelearner.Poweredby Esos Technologies     Welcome to Ccodelearner Ccodelearner asks for your consent to use your personal data to:  Personalisedads andcontent adandcontent measurement audience insights andproduct development  Store and/or access information on a device Your personal data will be processed and informationfrom your device (cookies unique identiers and other device data) may be stored by accessed by and shared with third party vendors, or used specically by this site or app Some vendors may process your personal data onthe basis of legitimate interest whichyoucanobject to by managing your options below Look for a link at the bottom of this page or inour privacy policy where youcan withdraw consent 

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.