Alert icon
We're changing our privacy policy. This stuff matters.  Learn more  Dismiss

Prelude to Computer Science - 12: The Concept of a Variable

Loading...

Sign in or sign up now!
2,318
Loading...
Alert icon
Sign in or sign up now!
Alert icon

Uploaded by on Aug 9, 2007

Other Languages and the concept of a variable.

All higher level languages I know of use the concept of a variable:
A named piece of storage that has contents and an interpretation (or type).

Category:

Howto & Style

Tags:

License:

Standard YouTube License

  • likes, 0 dislikes

Link to this comment:

Share to:

Uploader Comments (TheFallibleFiend)

  • what about signed and unsigned numbers? They look the same in memory, how does the computer know how to handle them? Do they have separate instructions for them too?

  • @adikid89 Very good question. It's the same opcode for both signed and unsigned, because both are handled with two's complement arithmetic. The difference is in how the return flags are handled. (It's been decades since I messed with it, so I apologize for not recalling the precise details.)

  • @TheFallibleFiend Any idea on where to find further information about this? What return flags are you talking about here? The sign flag and overflow flag? I know that overflow happens in two's complement... does that have anything to do with how the computer knows that at that address there is a negative number?

  • @adikid89 Yes, those are the flags. Probably wiki has something on it under "two's complement arithmetic." IIRC, the computer doesn't know a number at a location is negative at the level of assembler / machine code.

see all

All Comments (9)

Sign In or Sign Up now to post a comment!
  • Brilliant !! So easy to understand when you explain and I think it will help me a lot to become a better programmer.

  • Thanks! I aiming on assembly just to learn how computer really works. It in my nature...I just cant accept that something is working without knowing how it really works. Its not very profitable to learn this way since I should rather spend my time learning some software solutions. I started with Unix and have realized that the best way to really understand computers and OS is to do programming on both levels-High and low level programming.

  • Thanks for the response. I'm glad it was helpful. C is a very good language to learn. Whether assembler is useful monetarily depends on what kind of job you have; however, regardless of whether you ever write any assembler on the job, it's generally useful for solidifying your knowledge of how the computer works. Good luck!

  • Sorry 4 late response. I didnt have access to internet for a while(Trip).

    Anyway...yeah, your videos have helped me alot!!! Im in process of learning C and I'll think Ill move after to assembly or will do that in parallel with C.Long way to go but I have time...and you helped me on that path.

  • In "float a = 12.4" it's the compiler that is first aware of the types and translates to the appropriate load command.  In the cases I'm familiar with, there are separate LOAD, STORE, ADD, MULITIPLY, etc. commands for integers and for floats (and different still for doubles!) and it's the compiler that translates to the correct op code. Does that answer the question?

Loading...

0 / 00Unsaved Playlist Return to active list
    1. Your queue is empty. Add videos to your queue using this button:
      or sign in to load a different list.
    Loading...Loading...Saving...
    • Clear all videos from this list
    • Learn more