Lec 12 Concept of Variables in C

Lec 12 Concept of Variables in C - FAST, National...

Info iconThis preview shows pages 1–9. 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: FAST, National University of Computer and Emerging Sciences, Islamabad 1 Lecture 12: Concept of Variables in C Course: Programming For Engineers-1 Asma Ahmad 2 Reference Ch.2 of Text Book 3 Variables You can store your program (algorithm) data into variables (also called memory locations) . In C language there are various types of variable available. Numbers can be signed, unsigned or floating point. Moreover, C language also provide a facility to store any text type information in a variable. 4 Memory Concepts Variables Variable names correspond to locations in the computer's memory Every variable has a name, a type, a size and a value Whenever a new value is placed into a variable (through scanf , for example), it replaces (and destroys) the previous value Reading variables from memory does not change them A visual representation integer1 45 5 Memory Concepts integer1 45 integer2 72 integer1 45 integer2 72 sum 117 A visual representation (continued) 6 Variables With each variable in C there are four things associated with it: Name Value Type Address 7 Data Types Following data types are available in C: int float double char void enum Note that there is not a boolean data type. C++ compilers do have a boolean datatype. 8 Modifiers The three data types above have the following modifiers. Short, Long, Signed, Unsigned The modifiers define the amount of storage allocated to the variable....
View Full Document

Page1 / 18

Lec 12 Concept of Variables in C - FAST, National...

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

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