Hi i have written this code, there is a problem with it !!!
void stcp(char *newstr,char *oldstr,char *slash)
{
int counter1 = 0;
int counter2 = 0;
int counter3 = 0;
while ((oldstr[counter1] != NULL) && (counter1 < MAX_FILE_NAME))
{
if (oldstr[counter1] != 012)
{
newstr[counter2++] = oldstr[counter1];
slash[counter3++] = oldstr[counter1];
if (newstr[counter2 - 1] == 057)
counter3 = 0;
}
counter1++;
}
newstr[counter2] = NULL;
slash[counter3] = NULL;
}
When i compile the program i get a warning like this
test.c: In function `stcp':
test.c:134: warning: comparison between pointer and integer
test.c:145: warning: assignment makes integer from pointer without a cast
test.c:146: warning: assignment makes integer from pointer without a cast
test.c: In function `main':
test.c:798: warning: return type of `main' is not `int'
Line 134 while ((oldstr[counter1] != NULL) && (counter1 < MAX_FILE_NAME))
Line 145 newstr[counter2] = NULL;
Line 146 slash[counter3] = NULL;
Why does testing for and assiging NULL give me problems - how can i resovle this ???????
also the last error, i have defined my main function to return Void, do i actually have to return void in the function ???
PLEASE HELP !!