Hi
Automatic variables are allocated space on the stack as CrasyCat says. When you leave the scope of the function or block where the variable was declared it will be deleted automatically.
You can allocate variables yourself using malloc() or whatever equivalent your C runtime library offers. These are allocated on the heap and remain there untile your explicitly free them.
You can also create static variables, either declared within the scope of a function or block; or declared outside all functions and blocks. These are usually allocated space in the BSS section by the linker and are part of your runtime image.
Pointers and arrays are a very important part of the C language. IMHO they are the _most_ important thing to understand properly. If you come from an assembler background they are usually easy to understand, but newer languages which try to be more type safe tend to hide the gory details so pointers can be hard to follow.
K&R The C Programming Language is not a bad place to start, but you should learn as much as you can about pointers, dereferencing pointers, pointers to pointers, arrays, arrays of pointers, multi-dimensional arrays, pointers to arrays of pointers, etc, etc!
Cheers,
Paul.
Edit:
PS I say all this having absolutely no experience with the 8 bit CPU or compiler that you are using but with 20 years of other C experience.
Message Edited by mccp on
2007-06-20 10:00 AM