{[ promptMessage ]}

Bookmark it

{[ promptMessage ]}

Variablesare declaredwiththefollowingformat datatype

Info icon This preview shows page 1. Sign up to view the full content.

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

Unformatted text preview: variable name Key words/reserved words cannot be used as a variable name 2 2 Variable deceleration In C++, the variable must be declared first and it can be used then. variables are declared with the following format: datatype var1, var2,…; d a ta ty p e s in C ++ a re int, flo a t, c h a r e tc . int fo r inte g e r typ e va ria b le , flo a t fo r flo a ting p o int va ria b le a nd c h a r fo r c h a ra c te r typ e va ria b le 3 3 Memory location When a variable is used in a computer program, the computer When associates it with a particular memory location. In other words, a variable is a space in the computer’s memory In set aside for a certain kind of data and gives a name of reference set Void main() { int a; a=40 ----------} a 40 Memory 4 4 Types of variables C ++ la ng ua g e p ro vid e s th re e typ e s o f va ria b le s Inte g e r va ria b le Inte g e r va ria b le d e c la ra tio n s ta te m e nt h a s th e fo rm int sum; T h e d e c la ra tio n c o ns is ts o f th e d a ta ty p e na m e int, fo llo we d b y...
View Full Document

{[ snackBarMessage ]}

What students are saying

  • Left Quote Icon

    As a current student on this bumpy collegiate pathway, I stumbled upon Course Hero, where I can find study resources for nearly all my courses, get online help from tutors 24/7, and even share my old projects, papers, and lecture notes with other students.

    Student Picture

    Kiran Temple University Fox School of Business ‘17, Course Hero Intern

  • Left Quote Icon

    I cannot even describe how much Course Hero helped me this summer. It’s truly become something I can always rely on and help me. In the end, I was not only able to survive summer classes, but I was able to thrive thanks to Course Hero.

    Student Picture

    Dana University of Pennsylvania ‘17, Course Hero Intern

  • Left Quote Icon

    The ability to access any university’s resources through Course Hero proved invaluable in my case. I was behind on Tulane coursework and actually used UCLA’s materials to help me move forward and get everything together on time.

    Student Picture

    Jill Tulane University ‘16, Course Hero Intern