Thread: Learning..........C

  1. #1
    Unregistered
    Guest

    Learning..........C

    Would like to better understand memory when it comes to programming. Variables can be assigned values within the program, however the use of pointers makes reference to a memory block instead of the actual variable? Are there different types of memory to consider when programming? What does "stack" mean? Any feedback would be appreciated.

    Thanks

  2. #2
    the Corvetter
    Join Date
    Sep 2001
    Posts
    1,584
    >> Are there different types of memory to consider when programming? <<

    Well, yes and no. C is considered the "High-level ASM". Of course there are "types" of memory, but C doesn't specify the types. For instance, to set aside memory, you declare a variable/pointer.

    There is a keyword you can use, though. The "register" keyword checks the CPU and puts the var in the register (memory of the chip) so it is quicker accessed.

    Understand?

    --Garfield
    1978 Silver Anniversary Corvette

  3. #3
    Registered User
    Join Date
    Dec 2001
    Posts
    88
    something about register!

    this keyword suggest the cpu to put it in the register - but if it doesn't fit in there - it isn't forced to overwrite data in the register


    every C program has 4 memory types!

    stack, heap, global variable and code!

    stack is a LIFO memory - Last In First Out

    it is a very fast memory so you should use it for count variables in loops (every local variable is pushed on the stack or register)
    Hope you don't mind my bad english, I'm Austrian!

Popular pages Recent additions subscribe to a feed

Similar Threads

  1. Machine Learning with Lego Mindstorms
    By DavidP in forum A Brief History of Cprogramming.com
    Replies: 14
    Last Post: 01-30-2009, 02:34 PM
  2. Best Approach for Learning
    By UCnLA in forum C Programming
    Replies: 5
    Last Post: 03-21-2008, 02:35 AM
  3. Need Help On a Simple Bank Program
    By oobootsy1 in forum C# Programming
    Replies: 9
    Last Post: 08-08-2005, 10:51 AM
  4. Fun Learning a New Language
    By UnregdRegd in forum A Brief History of Cprogramming.com
    Replies: 16
    Last Post: 09-30-2003, 10:03 PM
  5. Learning Rate Of C++
    By Krak in forum C++ Programming
    Replies: 27
    Last Post: 01-29-2003, 01:53 PM