Completing basics

Completing basics - Introduction to C Introduction to C • Rules for forming variable(Identifier names – First character must be a letter or

Info iconThis preview shows pages 1–8. Sign up to view the full content.

View Full Document Right Arrow Icon

Info iconThis preview has intentionally blurred sections. Sign up to view the full version.

View Full DocumentRight Arrow Icon

Info iconThis preview has intentionally blurred sections. Sign up to view the full version.

View Full DocumentRight Arrow Icon

Info iconThis preview has intentionally blurred sections. Sign up to view the full version.

View Full DocumentRight Arrow Icon

Info iconThis preview has intentionally blurred sections. Sign up to view the full version.

View Full DocumentRight Arrow Icon
This is the end of the preview. Sign up to access the rest of the document.

Unformatted text preview: Introduction to C++ Introduction to C++ • Rules for forming variable(Identifier) names: – First character must be a letter or underscore – Only letters, digits, or underscores may follow the initial (no blanks allowed) – Keywords cannot be used • Use underscores to separate multiple words in a name, or capitalize the first letter of each word . Forming variable name: It is a reserved name that represents a built-in object or function of the language Keyword Examples of valid C++ identifiers: DegToRad intersect addNums slope find_min multTwo FindMax density _sum Examples of invalid C++ identifiers: 1AB3 (begins with a number) E*6 (contains a special character) while (this is a keyword) 4 Symbolic Constants Symbolic Constants • Symbolic constant: a constant value that is declared with an identifier using the const keyword • A constant’s value may not be changed Example: const int MAXNUM = 100; • Good programming places statements in appropriate order Comments Comments • Line comment : begins with // and continues to the end of the line – Line comment can be on a line by itself, or at the end of a line of code – Line comment cannot be longer than one line There is two types of comment: Line Comments Line Comments • Block Comment : a comment that spans across two or more lines – Block comment begins with /* and ends with */ Example: /* This is a block comment that spans across three lines */ Data Types...
View Full Document

This note was uploaded on 03/12/2012 for the course IT 101 taught by Professor Fadi during the Spring '12 term at University of Damascus.

Page1 / 28

Completing basics - Introduction to C Introduction to C • Rules for forming variable(Identifier names – First character must be a letter or

This preview shows document pages 1 - 8. Sign up to view the full document.

View Full Document Right Arrow Icon
Ask a homework question - tutors are online