DIFFERENT CODE BROKEN WA?
3 posters
Page 1 of 1
DIFFERENT CODE BROKEN WA?
My gay function is not compiling because its not pointing to the 2 strings any reason why because i made it bool instead of int because i don't want it returning anything other than true or false.
I also set the delimeter to ('\0')
I also set the delimeter to ('\0')
- Code:
#include <stdio.h>
#include <Windows.h>
bool compstr(const char *charstr1, const char *charstr2)
{
while(*charstr1==*charstr2)
{
if(*charstr1 == '\0')
return 0;
charstr1++;
charstr2++;
}
return (char *)charstr1 - (char *)charstr2;
}
int main()
{
if(!compstr("str", "str"))
{
printf("Strings Match.");
}
getchar();
return 0;
}
Aker- Site Regular
- PSL Awards : N/A
Posts : 32
Re: DIFFERENT CODE BROKEN WA?
Perhaps because your passing 2 strings into a function that's asking for parameter type char
meh- Site Beast
- PSL Awards : 1 Award (Click to view)
Posts : 287
Re: DIFFERENT CODE BROKEN WA?
No thats not it the strcmp() is coded in C not C++.meh wrote:Perhaps because your passing 2 strings into a function that's asking for parameter type char
Aker- Site Regular
- PSL Awards : N/A
Posts : 32
Re: DIFFERENT CODE BROKEN WA?
Aker wrote:No thats not it the strcmp() is coded in C not C++.meh wrote:Perhaps because your passing 2 strings into a function that's asking for parameter type char
Then you just answered your own question lol
meh- Site Beast
- PSL Awards : 1 Award (Click to view)
Posts : 287
Re: DIFFERENT CODE BROKEN WA?
FML, i forgot to point the const's to *
Im dumb
Im dumb
Aker- Site Regular
- PSL Awards : N/A
Posts : 32
Re: DIFFERENT CODE BROKEN WA?
Aker wrote:My gay function
lol
Dill- Site Nerd
- PSL Awards : 9 Awards (Click to view)
Posts : 748
Page 1 of 1
Permissions in this forum:
You cannot reply to topics in this forum
|
|