Hello, i have been coding for quite a while now. Up until now i have not figured out weather or not to do this.

somthing * newsomthing; 

newsomthing->funtion();

or this

somthing newsomthing;
newsomthing.function();

I know what a pointer is , but often i dont know weather or not to use one or not. I feel that this will turn into a problem one day if now resolved, can anyone tell me the difference? thanks.

Well, since your first example is an prime example if dereferencing an uninitialized pointer, I'm tempted to suggest that you learn more about pointers. But I actually have a better answer to your immediate problem of not knowing when to use a pointer: don't use pointers.

If you refrain from using pointers initially, the situations where you need them will become readily apparent. And from there you can build a base of experience of where you needed them before.

Hello, i have been coding for quite a while now. Up until now i have not figured out weather or not to do this.

somthing * newsomthing; 

newsomthing->funtion();

or this

somthing newsomthing;
newsomthing.function();

I know what a pointer is , but often i dont know weather or not to use one or not. I feel that this will turn into a problem one day if now resolved, can anyone tell me the difference? thanks.

Keep it simple. If you don't need to use pointers, that is you can use regular non-pointer type, then use them. That's all there is to it. If for some reason you do need pointers, (ex linked list?) then use them.

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.