| | |
error: Type mismatch in redecleration on 'throw_cards'
![]() |
i have no idea whats wrong with this function =\
i get the error: Type mismatch in redecleration on 'throw_cards'
and it shows me the 2ND line
C Syntax (Toggle Plain Text)
void throw_cards(card h_cards[]) { char f; cleardevice(); while(f!='f') { printf("from 0 to 6 pick the cards you want to thorw\n"); printf("to finish hit 'f'"); f=getch(); printf("trowing card %c",f); } }
i get the error: Type mismatch in redecleration on 'throw_cards'
and it shows me the 2ND line
C Syntax (Toggle Plain Text)
{
char f;
f=getch(); "If it moves, tax it. If it keeps moving, regulate it, and if it stops moving, subsidize it" - Ronald Reagan stating how a liberal's mind works.
Trying to call it before you prototype it will cause the compiler to declare it implicitly.
This implicit declaration will almost certainly conflict with the actual definition you provide later on.
This implicit declaration will almost certainly conflict with the actual definition you provide later on.
If you dance barefoot on the broken glass of undefined behaviour, you've got to expect the occasional cut.
--
If your code lacks code tags, you will be IGNORED
--
If your code lacks code tags, you will be IGNORED
this function works
so i guess i can put
and Narue what the prototype????
and i have no idea that salem means =\
C Syntax (Toggle Plain Text)
void check() { char e; e=getch(); if(e=='e') exit(1); else if(e=='s') start(); else { cleardevice(); printf("ERROR:%c unknown\n\nPress\ns to Start game\na to About\ne to Exit",e); check(); } }
so i guess i can put
C Syntax (Toggle Plain Text)
char f; f=getch();
and Narue what the prototype????
and i have no idea that salem means =\
>so i guess i can put
I quote those to point out what I was referring to. In fact, you should change every variable that is going to hold the return of getch() to type int.
e.g
Now you can use that one. That's the proper way.
>and Narue what the prototype????
If you code this function after the main function:
The prototype would be a signature of this function placed somewhere before the call of it.
This signature would be:
void throw_cards(card h_cards[]);
Basically you make a copy of the function header and add a ; at the end of it, and place it before being called in main or other function; that way the compiler knows what to expect at compilation time.
>and i have no idea that salem means =\
If you didn't know what a prototype was; of course you wouldn't understand what he's saying.
•
•
•
•
char f;
f=getch();
e.g
C Syntax (Toggle Plain Text)
int f; f = getch();
>and Narue what the prototype????
If you code this function after the main function:
C Syntax (Toggle Plain Text)
void throw_cards(card h_cards[]) { char f; cleardevice(); while(f!='f') { printf("from 0 to 6 pick the cards you want to thorw\n"); printf("to finish hit 'f'"); f=getch(); printf("trowing card %c",f); } }
This signature would be:
void throw_cards(card h_cards[]);
Basically you make a copy of the function header and add a ; at the end of it, and place it before being called in main or other function; that way the compiler knows what to expect at compilation time.
>and i have no idea that salem means =\
If you didn't know what a prototype was; of course you wouldn't understand what he's saying.
Last edited by Aia; Jan 7th, 2008 at 2:38 pm.
"If it moves, tax it. If it keeps moving, regulate it, and if it stops moving, subsidize it" - Ronald Reagan stating how a liberal's mind works.
![]() |
Other Threads in the C Forum
- Previous Thread: storing arguments from command line
- Next Thread: packing wav data in c
Views: 1190 | Replies: 6
| Thread Tools | Search this Thread |
Tag cloud for C
api array arrays binary binarysearch c++ char character code coke command conversion convert copy creafecopyofanytypeoffileinc database decimal directory dude dumpandrun dynamic ebook error evaluation exec factorial fflush(stdout) fgets file fork frequency function functions givemetehcodez grade graphics gray homework i/o incrementoperators input insert int integer lazy leak leet_speak libcurl line linked linkedlist linux list lists loop malloc matrix memory mysql no-effort open output path pointer pointers precedence problem process program programming read recursion recursive recv refresh reverse roman2decimal scanf scripting send socketprograming spoonfeeding string strings strtok structures student studio swap system turbo-c turboc unix user variable visual webpage why-not-to-use-turbo windows winxp






