• Content count

  • Joined

  • Last visited

Community Reputation

103 Neutral

About LarsDC

  • Rank
  1. Thanks for the response [img][/img] I had a feeling a month of c++ wouldn't get it in place so it's nice to get some feedback. At least I know I need to practice some more and read a bit more also. I did know that if you cout a pointer you'll get the memory address and not the variable value itself hence them always being integers, if that is what you meant. Still much appreciate the response. Regarding the member variable. I think I kinda switched around local and member didn't I? Local being class visible and member being function specific. Again much appreciated! [img][/img]
  2. [quote name='EngineProgrammer' timestamp='1346467107' post='4975303'] In your response I want 2 answers from you: Could you explain me, in a neat/technical sentence, how a pointer works? Could you explain me what the difference is between a local, global, member variable? Also in in neat sentence. [/quote] I'm not him but I couldn't resist this little challenge. Always fun to see if I've listened closely enough during my school lessons. Actually created a user here on the awesome to post this [img][/img] [b]Pointer[/b]: A pointer work in the way that it gives you direct access to the memorybank/memoryspace in which a variable is stored on your computer. Meaning the chunk of memory that is reserved for this variable. Meaning if you forget to *pointer=0 before reassigned it another value you will create memory leaks as the memorybank is still "locked". Variables: [b]Local [/b]- Local variables are variables accessible by all functions within the class where it is created. Example: int main{ int a; } //Destroyed when the block/function/class ends [b]Member [/b]- Member variables are only accessible within the scope where they are created meaning inside a function for instance Example: int main{ void randomName(){ int a; } } //Destroyed when the block/function ends [b]Global [/b]- Global variables are accessible from everywhere in your program, hence the name global. Example: int a; int main(){ } //Destroyed when the program terminates Wow that was more than a sentence, sorry. Of course I would appriciate it a lot if you would confirm if I have indeed been listening or need to redo my last semester ;) You are of course welcome to PM me the answer as to not spoil it completely. And sorry for hijacking/butting in on the post [img][/img]