1. ## Pointers

Iv'e just started learning about pointers. I understand how they work but I don't see the reason to use them. Why use a pointer when you could just use the actual variable. It doesn't make sense to me. Please explain carefully the reason remembering that I am a noob.

2. Check the topic below as it may be useful. Don't know though since I was too lazy to examine it to any degree. But considering it is three pages long it should be helpful.

http://cboard.cprogramming.com/showt...ointers+reason

One thing I just thought of. Pointers are used for a variety of storage techniques. Two I can think of off the top of my head are linked lists and binary trees.[/edit]

3. This is a pointer to yourself http://cboard.cprogramming.com/showthread.php?t=57094
This is a pointer to void http://void.void.void/
This is a pointer to a pointer tutorial http://pweb.netcom.com/~tjensen/ptr/pointers.htm

4. thankz frobozz, that helped alot. now im learning about classes. theres just an example in the tutorial that seems crazy. ill post it
Code:
```class Dog {
public:
void setAge(int age);
int getAge();
void setWeight(int weight);
int getWeight();
void speak();
private:
int age;
int weight;
};```
i got this tutorial from polonyman and its been great. what ticks me is that the tutorial never explained about void. what is it? how does it work? and what does it do? i understand public and private so don't worry about that just explain

5. void almost means 'nothing' .
for example when you have a function that it returns an ' int ' before the functaion name you write 'int'.
anf if you have a function that it doesnt return anything(no int , no float , no char .......) before the name of this functoin you write 'void'
hope it helps.

6. An aside but I believe void in the parameter list of a C function means you can have any number of parameters in the argument list. correct me if i am wrong

7. You're wrong
void means that there are NO arguments, while nothing in the parameter list means, in C only, any number of arguments. In C++, an empty argument list and a void argument list are the same.

8. is this legal ?
Code:
`void variable1;`
if it is, what does it mean ?

9. Thanks for correcting me there. I knew it was specific to C but was confusing an empty list with a void list of parameters. Pulled it off the back of my brain which thanks to CornedBee has been revealed to be defective. Can I get a trade in?

I don't think
void variable is legal but
void * variable is

again I could be wrong.

10. void variable1;
is not valid. Why? Because it would have no meaning. You can't have a variable of no type.

void *ptr1;
is valid though. The variable has the type "memory address without any information as to what might be at that address."

11. oh....... i get it. thanks,CornedBee

12. You can use it to link structures together, like in a linked list

13. so are you trying to say that void means that the data has no type, and needs to be specified before use? unless it means that the pointer is declareed, but the type eg int isn't declared. does that mean you need to declare a type before use, or is it comatible with any standard data type?

14. No for the case of the class the void function just means it doesn't return a value(int,float,char,...). As for the pointer I believe a void pointer is just a pointer that points to nothing.

15. void pointers do point to something: memory. Unless they're NULL pointers.
void means that the data has no type or there is no data, just raw memory (malloc returns void*) or the type is unknown to whoever handles the pointer. Someone with more knowledge can always cast the pointer to some non-void type.