1 / 10

Memory Concepts in Computer Science

Memory Concepts in Computer Science. Programmers as Manipulators of Memory!!. What’s a Variable?. A storage place in computer’s memory can change throughout the program’s execution (can vary!!) must declare the variable at beginning of program.

Télécharger la présentation

Memory Concepts in Computer Science

An Image/Link below is provided (as is) to download presentation Download Policy: Content on the Website is provided to you AS IS for your information and personal use and may not be sold / licensed / shared on other websites without getting consent from its author. Content is provided to you AS IS for your information and personal use only. Download presentation by click this link. While downloading, if for some reason you are not able to download a presentation, the publisher may have deleted the file from their server. During download, if you can't get a presentation, the file might be deleted by the publisher.

E N D

Presentation Transcript


  1. Memory Concepts in Computer Science Programmers as Manipulators of Memory!!

  2. What’s a Variable? • A storage place in computer’s memory • can change throughout the program’s execution (can vary!!) • must declare the variable at beginning of program

  3. describes what kind of data is going to be stored – called the data type name for the variable Declaring Variables … what happens? Num : integer;

  4. garbage!! Num -12583487 Declaring Variables … what happens? Num : integer; declaration only allocates space in memory!!!

  5. assume user types 35 Assigning values to variables what happens? Num : integer; begin Num := 5; Num := 60; get(num); Num -12583487 5 60 35 only one value at a time can be stored … destructive process!

  6. Num 5 Declaring Variables … what happens? Num : integer:=5; declaration not only allocates space in memory but also places value in there!!!

  7. Lname & * ^ % # @ * ) notice garbage is still in end of string! C h i % # @ * ) C h i % # @ * ) Declaring Variables … what happens? Lname : string(1..8); begin lname(1..3):= “Chi”; put(Lname);

  8. tells how many characters were entered!! Lname & * ^ % # @ * ) only using the characters that were entered!! C h i % # @ * ) Chi Declaring Variables … what happens? Lname : string(1..8); begin get_line(Lname,n); put(Lname(1..n);

  9. Assignment for next class • Read Chapter 1 – Structure of an Ada Program

  10. Some questions to answer: • Describe what is meant by these parts of a program in Ada: • main (executable) block • declaration block • What is the difference in a variable & a constant? • What are reserved words? • What is the source code? • What is the difference in compiling & building a program? • What is syntax error, warning, run-time error, & a logic (application) error? • Why is the USE statement so nice to use?

More Related