Error: assignment makes pointer from integer without a cast
Solved
Unnamed_Man
Posted messages
47
Status
Member
-
Unnamed_Man Posted messages 47 Status Member -
Unnamed_Man Posted messages 47 Status Member -
Good evening,
An error message (assignment makes pointer from integer without a cast) appears when I run this code:
What is the problem?
Thanks in advance.
An error message (assignment makes pointer from integer without a cast) appears when I run this code:
void proposeLetter(char letter, char* word, char* hiddenWord, int* attempts) { for (int i = 0; i < strlen(word); i++) { if (word[i] == letter) { hiddenWord[i] = letter; } else { attempts = i + 1; } } } What is the problem?
Thanks in advance.
| EDIT : Added code tags (syntax highlighting). Explanations available here: HERE Thank you for keeping this in mind in your future messages. |
2 answers
-
tries = i + 1;
tries is of type int*
i is of type int
that can't work, what do you want to do there?
--
I mainly work in VB6 and VB.NET, with a bit of C#, but moderation often brings me to other languages.
In VB.NET make sure to enable "Option Explicit" and "Option Strict" -
Thank you for your responses, the problem is resolved, it was just a slip of the mind ;-)
--
Don't forget to mark the subject as "resolved" when it is, and a little "thank you" is always appreciated ;-)