0% found this document useful (0 votes)
53 views

Programming Fundamentals: 4.00 Credit Hours, Fall 2015, Undergraduate Program

This document outlines a lecture on programming fundamentals for an undergraduate C/C++ course. It discusses the C character set, basic constants including integer, real, and character constants, and variables. Constants represent values that do not change, while variables represent locations in memory that can be assigned different values during program execution. The document provides examples and rules for forming valid constants and variable names in C. Keywords also cannot be used as variable names since they have predefined meaning to the compiler.

Uploaded by

Mir Fida Nadeem
Copyright
© © All Rights Reserved
Available Formats
Download as PPTX, PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
53 views

Programming Fundamentals: 4.00 Credit Hours, Fall 2015, Undergraduate Program

This document outlines a lecture on programming fundamentals for an undergraduate C/C++ course. It discusses the C character set, basic constants including integer, real, and character constants, and variables. Constants represent values that do not change, while variables represent locations in memory that can be assigned different values during program execution. The document provides examples and rules for forming valid constants and variable names in C. Keywords also cannot be used as variable names since they have predefined meaning to the compiler.

Uploaded by

Mir Fida Nadeem
Copyright
© © All Rights Reserved
Available Formats
Download as PPTX, PDF, TXT or read online on Scribd
You are on page 1/ 12

Course:

Programming Fundamentals
4.00 Credit Hours, Fall 2015,
Undergraduate Program
Instructor: Maryam Ehsan
Learning C/C++

2
Today’s lecture outline
 C character set
 Basic constants and variables

3
C Character Set

4
Constants
 An entity that doesn’t change

5
Integer Constants
 Must have at least one digit
 It must not have a decimal point
 It can be either positive or negative
 If there is no sign an integer constant is assumed to
be positive
 No commas or blanks are allowed within an integer
constant
 Examples: 135, -67, 3401, -5670

6
Real Constants
 Also called Floating Point constants
 A real constant must have at least one digit
 It must have a decimal point
 It could be either positive or negative
 Default sign is positive
 No commas or blanks are allowed within a real
constant
 Examples: +325.34, 426.0, -32.76, -48.5792

7
Character Constants
 A character constant is a
 single alphabet
 a single digit
 or a single special symbol
 Enclosed within single inverted commas
 Both the inverted commas should point to the left
 The maximum length can be 1 character
 Examples: ’A’, ‘I’, ‘5’, ‘=‘

8
Variables…
 An entity that may vary during program execution
 Names given to locations in memory

x=3 x=5

9
Variables..
 No commas or blanks are allowed within a variable
name.
 No Special symbol are used in name.
 Examples: Interger1, Sum, _FirstNum
 Invalid variable names
 #sum, 12x, first name

10
Variable Types

11
Keywords
 Meaning already explained to compiler
 Cannot be used as variable name

12

You might also like