17 Programming Foundations - Variables
17 Programming Foundations - Variables
ProgrammingAdvices.com
MBA, PMOC, PgMP®, PMP®, PMI-RMP®, CM, ITILF, MCPD, MCSD
Copyright© 2022 26+ years of experience
Mohammed Abu-Hadhoud
ProgrammingAdvices.com
MBA, PMOC, PgMP®, PMP®, PMI-RMP®, CM, ITILF, MCPD, MCSD
Copyright© 2022 26+ years of experience
Mohammed Abu-Hadhoud
ProgrammingAdvices.com
MBA, PMOC, PgMP®, PMP®, PMI-RMP®, CM, ITILF, MCPD, MCSD
Copyright© 2022 26+ years of experience
Computer Foundations
Variables
Mohammed Abu-Hadhoud
ProgrammingAdvices.com
MBA, PMOC, PgMP®, PMP®, PMI-RMP®, CM, ITILF, MCPD, MCSD
Copyright© 2022 26+ years of experience
Mohammed Abu-Hadhoud
ProgrammingAdvices.com
MBA, PMOC, PgMP®, PMP®, PMI-RMP®, CM, ITILF, MCPD, MCSD
Copyright© 2022 26+ years of experience
In the kitchen
Containers
Mohammed Abu-Hadhoud
ProgrammingAdvices.com
MBA, PMOC, PgMP®, PMP®, PMI-RMP®, CM, ITILF, MCPD, MCSD
Copyright© 2022 26+ years of experience
Mohammed Abu-Hadhoud
ProgrammingAdvices.com
MBA, PMOC, PgMP®, PMP®, PMI-RMP®, CM, ITILF, MCPD, MCSD
Copyright© 2022 26+ years of experience
What are Variables?
Variables are containers for storing data values
Mohammed Abu-Hadhoud
ProgrammingAdvices.com
MBA, PMOC, PgMP®, PMP®, PMI-RMP®, CM, ITILF, MCPD, MCSD
Copyright© 2022 26+ years of experience
Computer Foundations
Variable Types
Mohammed Abu-Hadhoud
ProgrammingAdvices.com
MBA, PMOC, PgMP®, PMP®, PMI-RMP®, CM, ITILF, MCPD, MCSD
Copyright© 2022 26+ years of experience
Primary Variable Types
Mohammed Abu-Hadhoud
ProgrammingAdvices.com
MBA, PMOC, PgMP®, PMP®, PMI-RMP®, CM, ITILF, MCPD, MCSD
Copyright© 2022 26+ years of experience
RAM
Type
Memory Location
Memory Cell
Name: Age
Int Age = 45 Value: 45
45 Address: 0x7fff5694dc58
Identifier Value
Mohammed Abu-Hadhoud
ProgrammingAdvices.com
MBA, PMOC, PgMP®, PMP®, PMI-RMP®, CM, ITILF, MCPD, MCSD
Copyright© 2022 26+ years of experience
Memory Cell
X
Name: Age
Int Age = 45 45 Address: 0x7fff5694dc58
Age = Age + 2 47
Age = 45 + 2
Age = 47
Mohammed Abu-Hadhoud
ProgrammingAdvices.com
MBA, PMOC, PgMP®, PMP®, PMI-RMP®, CM, ITILF, MCPD, MCSD
Copyright© 2022 26+ years of experience
Computer Foundations
Constants
Mohammed Abu-Hadhoud
ProgrammingAdvices.com
MBA, PMOC, PgMP®, PMP®, PMI-RMP®, CM, ITILF, MCPD, MCSD
Copyright© 2022 26+ years of experience
What are Constants?
Constants are containers for storing data values, but they are read only.
Mohammed Abu-Hadhoud
ProgrammingAdvices.com
MBA, PMOC, PgMP®, PMP®, PMI-RMP®, CM, ITILF, MCPD, MCSD
Copyright© 2022 26+ years of experience
Type
Memory Location
Memory Cell
Name: PI
Const Float PI = 3.14 Value: 3.14
3.14 Address: 0x7ffd5794dc58
Identifier Value
Mohammed Abu-Hadhoud
ProgrammingAdvices.com
MBA, PMOC, PgMP®, PMP®, PMI-RMP®, CM, ITILF, MCPD, MCSD
Copyright© 2022 26+ years of experience
Memory Cell
Name: PI
Const Float PI = 3.14 Value: 3.14
3.14 Address: 0x7ffd5794dc58
PI = PI + 2
Error
Mohammed Abu-Hadhoud
ProgrammingAdvices.com
MBA, PMOC, PgMP®, PMP®, PMI-RMP®, CM, ITILF, MCPD, MCSD
Copyright© 2022 26+ years of experience
Computer Foundations
Performance Tips
Mohammed Abu-Hadhoud
ProgrammingAdvices.com
MBA, PMOC, PgMP®, PMP®, PMI-RMP®, CM, ITILF, MCPD, MCSD
Copyright© 2022 26+ years of experience
If you want to drink coffee, then..
It is ok to Drink It is not ok to
Coffee like this. drink it like this.
Mohammed Abu-Hadhoud
ProgrammingAdvices.com
MBA, PMOC, PgMP®, PMP®, PMI-RMP®, CM, ITILF, MCPD, MCSD
Copyright© 2022 26+ years of experience
A B
35 5
1 Visit 7 Visits
Mohammed Abu-Hadhoud
ProgrammingAdvices.com
MBA, PMOC, PgMP®, PMP®, PMI-RMP®, CM, ITILF, MCPD, MCSD
Copyright© 2022 26+ years of experience
Mohammed Abu-Hadhoud
ProgrammingAdvices.com
MBA, PMOC, PgMP®, PMP®, PMI-RMP®, CM, ITILF, MCPD, MCSD
Copyright© 2022 26+ years of experience
Don’t waste memory !!!!!
Age
Human lives 100-150 years
Maximum number you need is 150
4,294,967,295
Mohammed Abu-Hadhoud
ProgrammingAdvices.com
MBA, PMOC, PgMP®, PMP®, PMI-RMP®, CM, ITILF, MCPD, MCSD
Copyright© 2022 26+ years of experience
Mohammed Abu-Hadhoud
ProgrammingAdvices.com
MBA, PMOC, PgMP®, PMP®, PMI-RMP®, CM, ITILF, MCPD, MCSD
Copyright© 2022 26+ years of experience
Answer the following questions:
• What is Variable? And why do we need it?
• What is constant? And why do we need it?
• What is Memory Cell?
• What is identifier?
• What is Memory Address? What is its relation to location?
• Which numbering system used in memory address?
• Mention the primary types of variables?
• What are the number’s types? And give an examples?
• What is string? And give an example on it.
• What is Boolean? and give an example on it.
Mohammed Abu-Hadhoud
ProgrammingAdvices.com
MBA, PMOC, PgMP®, PMP®, PMI-RMP®, CM, ITILF, MCPD, MCSD
Copyright© 2022 26+ years of experience
Answer the following questions:
• Are all variables and constants have the same size?
• What happens when you use much larger size than you need
in variables?
• Can we modify a variable during the program?
• Can we modify a constant during the program?
• How to make a variable read only?
• Where do the variables and constants get stored?
• What is the difference between Integers and Floats?
Mohammed Abu-Hadhoud
ProgrammingAdvices.com
MBA, PMOC, PgMP®, PMP®, PMI-RMP®, CM, ITILF, MCPD, MCSD
Copyright© 2022 26+ years of experience
???
???
Memory Location
???
Name: ???
Int Age = 45 Value: ???
45 Address: ???
??? ???
Mohammed Abu-Hadhoud
ProgrammingAdvices.com
MBA, PMOC, PgMP®, PMP®, PMI-RMP®, CM, ITILF, MCPD, MCSD
Copyright© 2022 26+ years of experience
Mohammed Abu-Hadhoud
ProgrammingAdvices.com
MBA, PMOC, PgMP®, PMP®, PMI-RMP®, CM, ITILF, MCPD, MCSD
Copyright© 2022 26+ years of experience