Reply to thread
GBAtemp.net - The Independent Video Game Community
Search
Search titles only
By:
Search titles only
By:
Reply to thread
GBAtemp.net - The Independent Video Game Community
Home
Log in
Terms & Rules
Donate
Forums
New posts
Search forums
Groups
Public Events
New
New posts
New resources
New blog entries
New profile posts
New blog entry comments
New threadmarks
Latest activity
Cheats
Cheat Codes Add and Request group
The Legend of Zelda: Tears of the Kingdom cheat codes
Pokémon Legends: Arceus cheat codes
Xenoblade Chronicles 3 cheat codes
Fire Emblem Engage cheat codes
Request a cheat...
Tutorials
Nintendo Switch tutorials
Nintendo 3DS tutorials
Nintendo Wii U tutorials
Reviews
Overview
Official reviews
User reviews
Downloads
Latest reviews
Search resources
Blogs
New entries
New comments
Blog list
Search blogs
Chat
Top chatters
Search
Search titles only
By:
Search titles only
By:
Log in
Register
New posts
Search forums
Log in
Register
Home
Forums
PC, Console & Handheld Discussions
Computer Technology and Gaming
compiler warning help
Menu
Install the app
Install
JavaScript is disabled. For a better experience, please enable JavaScript in your browser before proceeding.
You are using an out of date browser. It may not display this or other websites correctly.
You should upgrade or use an
alternative browser
.
Reply to thread
Message
<blockquote data-quote="spoonm" data-source="post: 5649157" data-attributes="member: 365962"><p>In line 27, inside minimax(), you pass &winner(the address of the local variable winner) to win. You are passing the address of a pointer to int, which is going to be of type pointer to pointer to int(int **). In win(), you are expecting an argument of type int *, not int **. What you probably meant to pass is winner itself, given the argument you received named winner is already of type int *.</p><p></p><p>The same is happening elsewhere, and that'll give you all those warnings. I hope you understand what I'm saying.</p><p></p><p>What you're meant to be doing is pass the int* winner you got as parameters in the functions you first called.</p><p></p><p>Example:</p><p>[CODE]int win (char board[3][3], int* winner, int player)</p><p>{</p><p> ...</p><p>}</p><p></p><p>...</p><p></p><p>int minimax (char board[3][3], int player, int* winner)</p><p>{</p><p> int winning = win(board, winner, player);</p><p> ...</p><p>}[/CODE]</p><p></p><p>winner, local variable in minimax(), is of type int*, which win() expects as its second argument.</p><p></p><p>EDIT:</p><p></p><p>I have made a few edits to your source code and added observations. I know I'll sound like a nitpicking jerk with what I placed there, but please give it some thought.</p><p></p><p>I'm assuming you're making it in C++, as declarations inside for parameters doesn't work in C unless in C99 mode. I compiled through g++ and got no warnings or errors, but when playing against the computer, the program crashes. I see a Y before the crash, so you know where to look for bugs.</p><p></p><p>Why does GBAtemp not let people upload .cpp files?</p></blockquote><p></p>
[QUOTE="spoonm, post: 5649157, member: 365962"] In line 27, inside minimax(), you pass &winner(the address of the local variable winner) to win. You are passing the address of a pointer to int, which is going to be of type pointer to pointer to int(int **). In win(), you are expecting an argument of type int *, not int **. What you probably meant to pass is winner itself, given the argument you received named winner is already of type int *. The same is happening elsewhere, and that'll give you all those warnings. I hope you understand what I'm saying. What you're meant to be doing is pass the int* winner you got as parameters in the functions you first called. Example: [CODE]int win (char board[3][3], int* winner, int player) { ... } ... int minimax (char board[3][3], int player, int* winner) { int winning = win(board, winner, player); ... }[/CODE] winner, local variable in minimax(), is of type int*, which win() expects as its second argument. EDIT: I have made a few edits to your source code and added observations. I know I'll sound like a nitpicking jerk with what I placed there, but please give it some thought. I'm assuming you're making it in C++, as declarations inside for parameters doesn't work in C unless in C99 mode. I compiled through g++ and got no warnings or errors, but when playing against the computer, the program crashes. I see a Y before the crash, so you know where to look for bugs. Why does GBAtemp not let people upload .cpp files? [/QUOTE]
Insert quotes…
Verification
Post reply
Home
Forums
PC, Console & Handheld Discussions
Computer Technology and Gaming
compiler warning help
General chit-chat
Help
Users
Settings
Notifications
Miscellaneous
Inverse message direction
Display editor on top
Enable maximized mode
Display images as links
Hide bot messages
Hide statuses
Hide chatter list
Show messages from ignored users
Temporarily disable chat
Receive mention alerts
Sound notifications
Normal messages
Private messages
Whisper messages
Mention messages
Bot messages
Desktop notifications
Normal messages
Private messages
Whisper messages
Mention messages
Bot messages
Options
Options
View top chatters
No one is chatting at the moment.
@
Psionic Roshambo
:
She saw the sign and it opened up her mind
Today at 12:25 AM
@
Psionic Roshambo
:
To the possibility of free rent lol
+1
Today at 12:25 AM
@
Xdqwerty
:
my brother found our copies of both pokemon diamond and pokemon black
Today at 12:28 AM
@
Xdqwerty
:
https://www.youtube.com/shorts/HYlQMBvdjkM
Today at 12:55 AM
@
Xdqwerty
:
https://youtu.be/AqspOhklc4Q
Today at 1:06 AM
@
Xdqwerty
:
sbeve
Today at 1:55 AM
@
Xdqwerty
:
yea im becoming a weeb slowly
Today at 1:55 AM
@
Xdqwerty
:
although a bit ashamed
Today at 2:15 AM
@
Xdqwerty
:
good night
Today at 2:33 AM
@
BigOnYa
:
Nighty night
Today at 2:40 AM
@
K3Nv2
:
Yawn
Today at 2:45 AM
@
BigOnYa
:
Wut
Today at 2:48 AM
@
BakerMan
:
fun fact: popeye with spinach solos
Today at 3:50 AM
@
BigOnYa
:
Spinach alone didn't give him those arm muscles
Today at 3:55 AM
@
BakerMan
:
true, but he's always the underdog until, at the lowest point of the battle, he eats some conveniently located spinach, then he fucks shit up
Today at 4:01 AM
@
BakerMan
:
also as of today i've been on nofap for 3 months
Today at 4:02 AM
@
BakerMan
:
so uh, yay me for breaking an addiction that many suffer from like that
Today at 4:03 AM
@
Sonic Angel Knight
:
+1
Today at 4:03 AM
@
BigOnYa
:
Maybe the spinach was just a metaphor. Maybe it was really meth or crack.
Today at 4:03 AM
@
K3Nv2
:
Spinach gave him a tumor
Today at 4:09 AM
@
BunnyPinkie
:
Plasturion is working on uncensoring imagine makeup artist!
Today at 4:10 AM
@
BigOnYa
:
Then we will recensor it...
Today at 4:11 AM
@
K3Nv2
:
We don't want to see that
shit
+1
Today at 4:12 AM
@
Sonic Angel Knight
:
Since when are bunnies pink?
52 minutes ago
@
Veho
:
The ones you are hallucinating, or...?
49 minutes ago
Submit
@
Veho
:
The ones you are hallucinating, or...?
49 minutes ago
Chat
0