Hit this exam harder than you have ever done before.
--Your friends at LectureNotes

Note for Programming in C - C By Subba Rao

  • Programming in C - C
  • Note
  • Jawaharlal Nehru Technological University Anantapur (JNTU) College of Engineering (CEP), Pulivendula, Pulivendula, Andhra Pradesh, India - JNTUACEP
  • Computer Science Engineering
  • 23 Topics
  • 477 Offline Downloads
  • Uploaded 1 year ago
0 User(s)
Download PDFOrder Printed Copy

Share it with your friends

Leave your Comments

Text from page-1

This watermark does not appear in the registered version - http://www.clicktoconvert.com 1 SR-IT Institute @ Beeramguda. UNIT I LESSON – 1 1.0 AIMS AND OBJECTIVES itu Aims and objectives Introduction Character set C Tokens Keywords and Identifiers Constants Variables Let us Sum Up Lesson -end Activities Model Answers to Check your Progress References st 1.0 1.1 1.2 1.3 1.4 1.5 1.6 1.7 1.8 1.9 1.10 te CONSTANTS & VARIABLES In In this lesson we are going to learn the character set, Tokens, Keywords, Identifiers, Constants and Variables of C programming language. 1.1 -IT After reading this lesson, we should be able to · identify C tokens · know C key words and identifiers · write constants and variables of C language INTRODUCTION SR A programming language is designed to help certain kinds of data process consisting of numbers, characters and strings to provide useful output known as information. The task of processing of data is accomplished by executing a sequence of precise instructions called program. 1.2 CHARACTER SET C characters are grouped into the following categories. 1. 2. 3. 4. Letters Digits Special Characters White Spaces Note: The compiler ignores white spaces unless they are a part of a string constant. Ph: 8801948390, 7396252455.

Text from page-2

This watermark does not appear in the registered version - http://www.clicktoconvert.com 2 SR-IT Institute @ Beeramguda. Letters Uppercase A….Z Lowercase a…..z Digits All decimal digits 0…..9 & Ampersand . Period ^ Caret ; Semicolon * Asterisk : Colon - Minus ? Question mark + Plus sign ‘ Apostrophe < “ Quotation mark > ! Exclamation ( Greater than Left parenthesis ) Right parentheses [ Left bracket In / Slash Less than st | Vertical Bar itu , Comma te Special characters ] Right bracket ~ Tilde { Left brace _ Underscore } Right brace $ Dollar sign # Number sign -IT \ Back slash SR % Percent sign White Spaces Ø Ø Ø Ø Ø Blank Space Horizontal Tab Carriage Return New Line Form Feed Tri-graph Characters Many non- English keyboards do not support all the characters. ANSI C introduces the concept of “Trigraph” sequences to provide a way to enter certain characters that are not available on some keyboards. Ph: 8801948390, 7396252455.

Text from page-3

This watermark does not appear in the registered version - http://www.clicktoconvert.com 3 SR-IT Institute @ Beeramguda. Translation ??= # Number sign ??( [ Left bracket ??) ] Right bracket ??< { Left brace ??> } Right brace ??! | Vertical bar ??/ ??’ ??- \ Back slash ^ Caret ~ Tilde te 1.3 Trigraph Sequence C TOKENS itu In C programs, the smallest individual units are known as tokens. In st C TOKENS Constants float while -15.5 100 -IT Keywords Identifiers SR main amount 1.4 Strings Operators “ABC” “year” +*, Special symbols [ ] { } KEYWORDS AND IDENTIFIERS Every C word is classified as either a keyword or an identifier. All keywords have fixed meanings and these meanings cannot be changed. Eg: auto, break, char, void etc., Identifiers refer to the names of variables, functions and arrays. They are user-defined names and consist of a sequence of letters and digits, with a letter as a first character. Both uppercase and lowercase letters are permitted. The underscore character is also permitted in identifiers. Ph: 8801948390, 7396252455.

Text from page-4

This watermark does not appear in the registered version - http://www.clicktoconvert.com 4 SR-IT Institute @ Beeramguda. 1.5 CONSTANTS Constants in C refer to fixed values that do not change during the execution of a program. CONSTANTS Integer constants Character Constants Real constants Single character constants itu Integer Constants String constants te Numeric Constants An integer constant refers to a sequence of digits, There are three types integers, namely, decimal, octal, and hexa decimal. st Decimal Constant Eg:123,-321 etc., Eg: 1) 15 750 In Note: Embedded spaces, commas and non-digit characters are not permitted between digits. 2)$1000 -IT Octal Constant SR An octal integer constant consists of any combination of digits from the set 0 through 7, with a leading 0. Eg: 1) 037 2) 0435 Hexadecimal Constant A sequence of digits preceded by 0x or 0X is considered as hexadecimal integer. They may also include alphabets A through F or a through f. Eg: 1) 0X2 2) 0x9F 3) 0Xbcd Ph: 8801948390, 7396252455.

Lecture Notes