easy question about passing by reference

Started by
16 comments, last by Real World 21 years, 6 months ago
quote:Original post by Stoffel
OK, maybe it's just the latent road rage since I sat gridlocked at a light through 3 cycles before getting home, but you people are freakin' morons.

  int **array = new int[800][600];     

error C2440: 'initializing' : cannot convert from 'int (*)[600]' to 'int ** '

You know, a sign of real intellect is keeping your mouth shut when you don't know what you're talking about.

Again, the very first freakin' response was the absolute, 100% correct answer. The rest of you need to take a class and shut your pie-holes.

[edited by - Stoffel on September 30, 2002 10:00:33 PM]




1.**a method doesn t work int *a[] is not a 2d array
2.stoffel you are a moderator a person to respect but your tone demands the opposit

[edited by - Basiror on October 1, 2002 12:09:08 PM]
http://www.8ung.at/basiror/theironcross.html
Advertisement
quote:Original post by Basiror
2.stoffel you are a moderator a person to respect but your tone demands the opposit

This point seems to come up often. I''ve modified my profile (job and description, specifically) to provide you more information.

ooo don''t start a war on my part. I got it working now thanks to the first guy

Planetblaze.com - www.planetblaze.com - As METAL as it gets!
Personally, Stoffel, you sound like a large-type asshole who has nothing better to do than to make people feel bad because they dont know something.

If this is how you act at the company you work at, then I don''t know who would want to work for you.
quote:Original post by Stoffel
Original post by Basiror
2.stoffel you are a moderator a person to respect but your tone demands the opposit

This point seems to come up often. I''ve modified my profile (job and description, specifically) to provide you more information.


+
It doesn''t mean I''m nice to posters–especially stupid posters.
+

hm i wonder what you consider to be a stupid poster

people who know less than you but know more than you did at their age

or newbies who don t know what they are doing?

nobody can be more stupid than someone who acts aggressive without any real reason


http://www.8ung.at/basiror/theironcross.html
quote:people who know less than you but know more than you did at their age

or newbies who don t know what they are doing?


It has nothing to do with that.

Stoffel, is saying that those that ''do not know the answer'' should not clutter up a thread with inane comments. And instead those that don’t know the answer either should watch the thread till a proper answer is finally provided.

By popping off wrong answers generates more confusion to the posters woes.

If you felt Stoffel''s tone was too much then you take criticism poorly and should ponder whether programming industry is really your cup of tea. This goes especially for those that answered the question wrong.
Allways the pointers seems to be the hardest thing in C/C++

* Do not do an int a[800][600]. Do insteadd a int *a = new int[800*600] (or a malloc in C). It save you from many troubles (but take care of delete/free ).
* Do the function as f(int xSize, int YSize, int* pData). It''s more easy to understand (on a long term).

* If you want an int a[800][600]; fine. Just remember that''s just some data in memory and so you can access it as raw data:
pass it to f( int xSize, int YSize, int* a) as f( 800,600, &a[0][0]).

Better - you are in C++ - so on a long term it''s better to use a class to store your array as it probablly represents something (the screen ) and then make it a singleton if you want (safer), or construct them with new and pass them as objects to functions or better use member functions to do the job on the array....so on... so on...
Good luck,
Pet.
Blimey!
All I did was look up passing multi-dimensional arrays to functions in Schildt''s "C++: The Complete Reference", and pass on the info I found to the original poster, who seemed happy enough with it. Where did the rest of this crap spring from?????

pan narrans
Study + Hard Work + Loud Profanity = Good Code
Minister of Propaganda : leighstringer.com : Nobody likes the man who brings bad news - Sophocles (496 BC - 406 BC), Antigone

This topic is closed to new replies.

Advertisement