Audience - Tutorialspoint

Transcription

C About the TutorialC is a middle-level programming language developed by Bjarne Stroustrup in 1979 atBell Labs. C runs on a variety of platforms, such as Windows, Mac OS, and the variousversions of UNIX.This tutorial adopts a simple and practical approach to describe the concepts of C .AudienceThis tutorial has been prepared for the beginners to help them understand the basic toadvanced concepts related to C .PrerequisitesBefore you begin practicing various examples given in this tutorial, we are making anassumption that you are already aware of some basics, like the computer softwareinstallation process and computer programming language.Copyright & Disclaimer Copyright 2014 by Tutorials Point (I) Pvt. Ltd.All the content and graphics published in this e-book are the property of Tutorials Point (I)Pvt. Ltd. The user of this e-book is prohibited to reuse, retain, copy, distribute or republishany contents or a part of contents of this e-book in any manner without written consentof the publisher.We strive to update the contents of our website and tutorials as timely and as precisely aspossible, however, the contents may contain inaccuracies or errors. Tutorials Point (I) Pvt.Ltd. provides no guarantee regarding the accuracy, timeliness or completeness of ourwebsite or its contents including this tutorial. If you discover any errors on our website orin this tutorial, please notify us at contact@tutorialspoint.comi

C Table of ContentsAbout the Tutorial . iAudience. iPrerequisites. iCopyright & Disclaimer . i1. OVERVIEW . 1Object-Oriented Programming . 1Standard Libraries . 1The ANSI Standard . 1Learning C . 22. ENVIRONMENT SETUP . 3Try it Option Online . 33. BASIC SYNTAX . 5C Program Structure. 5Compile & Execute C Program . 6Semicolons & Blocks in C . 6C Keywords . 74. COMMENTS IN C . 105. DATA TYPES. 11Primitive Built-in Types . 11typedef Declarations . 13Enumerated Types . 146. VARIABLE TYPES . 15ii

C Variable Definition in C . 15Variable Declaration in C . 16Lvalues and Rvalues . 187. VARIABLE SCOPE . 19Local Variables . 19Global Variables. 20Initializing Local and Global Variables . 218. CONSTANTS/LITERALS . 22Integer Literals . 22Floating-point Literals . 22Boolean Literals . 23Character Literals . 23String Literals . 24Defining Constants. 259. MODIFIER TYPES . 27Type Qualifiers in C . 2810. STORAGE CLASSES. 29The auto Storage Class . 29The register Storage Class . 29The static Storage Class . 29The extern Storage Class . 31The mutable Storage Class . 3211. OPERATORS. 33Arithmetic Operators . 33Relational Operators. 35Logical Operators . 37iii

C Bitwise Operators . 39Assignment Operators . 41Misc Operators . 44Operators Precedence in C . 4512. LOOP TYPES. 48While Loop . 49Loop Control Statements . 57The Infinite Loop . 6313. DECISION-MAKING STATEMENTS . 65If Statement . 66if else Statement . 67if.else if.else Statement . 69Switch Statement . 71Nested if Statement . 73The ? : Operator . 7614. FUNCTIONS . 77Defining a Function . 77Function Declarations . 78Calling a Function . 78Function Arguments . 8015. NUMBERS . 87Defining Numbers in C . 87Math Operations in C . 88Random Numbers in C . 9016. ARRAYS . 92Declaring Arrays . 92iv

C Initializing Arrays . 92Accessing Array Elements . 93Arrays in C . 94Passing Arrays to Functions . 9817. STRINGS . 104The C-Style Character String . 104The String Class in C . 10618. POINTERS .

C Compiler This is an actual C compiler, which will be used to compile your source code into final executable program. Most C compilers don't care what extension you give to your source code, but if you don't specify otherwise, many will use .cpp by default. Most frequently used and free available compiler is GNU C/C compiler, otherwise you canFile Size: 992KBPage Count: 54Explore furtherThe C Language Tutorial - cplusplus.comwww.cplusplus.comLecture notes on C programmingthatchna.weebly.comC Handwritten Notes PDF C Programming Notes Pdf Free .www.tutorialsduniya.comC lecture notesfleuret.orgPractical C Programming - Uniwersytet Warszawskiwww.mimuw.edu.plRecommended to you based on what's popular Feedback