June 25, 2024, 08:20:12 PM

News:

Own IWBasic 2.x ? -----> Get your free upgrade to 3.x now.........


The correct way to declare multiple pointer variables

Started by Parker, January 06, 2006, 07:28:22 PM

Previous topic - Next topic

0 Members and 3 Guests are viewing this topic.

Parker

I was just wondering, since I hadn't been able to figure it out, what is the correct way to declare multiple pointer variables?
// First way
string *pStr1, pStr2;

assuming that string* is the type
//Second way
string *pStr1, *pStr2;

assuming that string is the type, and pStr1, pStr2 are pointers of that type.

Ionic Wind Support Team

The second way.  The first way delcares a pointer to a string, and a string variable

Paul.
Ionic Wind Support Team

Parker

Alright thanks. Strings are a nice thing to have, but the non-dynamicness of them is hard to work with when you're loading files that could be 10 or 10 000 lines. *cough* operator-overloading *cough* ;)

Zen

Thats a nasty cough you have there Parker. Try some cough medicine lol

Lewis