Programming Forums
User Name Password Register
 

RSS Feed
FORUM INDEX | TODAY'S POSTS | UNANSWERED THREADS | ADVANCED SEARCH

Reply
 
Thread Tools Display Modes
Old Dec 9th, 2005, 1:34 PM   #11
Kilo
Expert Programmer
 
Kilo's Avatar
 
Join Date: Nov 2005
Location: In Pink Clam?
Posts: 542
Rep Power: 0 Kilo is an unknown quantity at this point
Send a message via AIM to Kilo
create a scientific calculater? all pointer based? with a nice GUI?

i believe that will put pointers to use, and also require some research on mathmatical forumals and maybe GUI? (just a suggestion)
__________________
"When in Rome, Do as the Romans Do"
"Beauty is in the eye of the BEER holder"
"Save your breath your going to need it for your blow up doll later"

SearchLores.org
Kilo is offline   Reply With Quote
Old Dec 9th, 2005, 1:36 PM   #12
Polyphemus_
Expert Programmer
 
Polyphemus_'s Avatar
 
Join Date: Aug 2005
Location: Rotterdam, the Netherlands
Posts: 942
Rep Power: 4 Polyphemus_ is on a distinguished road
Quote:
Originally Posted by Sane
Okay, in my Tic-Tac-Toe game, I created a pointer to the array containing the board data. That pointer is passed through the function (and recieved under the name board) to draw the board. But in that function, when I go :

cout << *board[x][y];

There is some sort of conversion error or something.
Can't see the rest of your code, but I think you want this:
cout << board[x][y];

Also, make sure you pass board in the following form:
type **board;
Polyphemus_ is offline   Reply With Quote
Old Dec 9th, 2005, 2:20 PM   #13
Sane
Programming Guru
 
Sane's Avatar
 
Join Date: Apr 2005
Location: Waterloo, Ontario
Posts: 2,075
Rep Power: 6 Sane will become famous soon enough
Send a message via MSN to Sane
Polyphemus_, But board is a pointer, and I thought to print the value of a pointer you go: cout << *pointer; Does this not apply to arrays?

EDIT: Wah, someone gave me negative karma on my first post...
Sane is online now   Reply With Quote
Old Dec 9th, 2005, 3:17 PM   #14
DaWei
Resident Grouch
 
DaWei's Avatar
 
Join Date: Jun 2005
Posts: 6,453
Rep Power: 10 DaWei is on a distinguished road
Read about pointers, what they are, and how they work. It isn't something you absorb by what you feel they ought to be. One way to look at them (generally frowned upon, but generally valid) is that they are indexes into the total array of memory addressable by your system. Obviously, one doesn't store data in an index; one stores data into the array element INDICATED by the index. A two dimensional array is just an array of arrays. You may address any element with the notation, Matrix [r][c]. You may also choose to address a row by its beginning position, and treat that BEGINNING position much like a pointer. It is, in fact, the address of an array. The address of an array is NOT precisely the same thing as a pointer, although there are operations (abetted by the compiler) in which they behave in much the same way. Again, you will find lots of inaccurate information relating to pointers. Read and think.
__________________
Abstraction doesn't make it impossible to write bad code; it makes it possible to write superior code.
Contributor's Corner: Grumpy on C++ Exceptions DaWei on Pointers
DaWei is offline   Reply With Quote
Reply

Bookmarks

« Previous Thread in Forum | Next Thread in Forum »

Currently Active Users Viewing This Thread: 1 (0 members and 1 guests)
 
Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Forum Jump




DaniWeb IT Discussion Community
All times are GMT -5. The time now is 8:37 PM.

Powered by vBulletin® Version 3.7.0, Copyright ©2000 - 2008, Jelsoft Enterprises Ltd.
Copyright ©2007 DaniWeb® LLC