there is no mistake..
they say that if the "if" statement is true then do this
what this line does??Code:strcopy(str+i,(str+i+1))
Printable View
there is no mistake..
they say that if the "if" statement is true then do this
what this line does??Code:strcopy(str+i,(str+i+1))
the if statement is
if (!i||str[i-1]==' '||i==strlen(str)-1)
this if does make any sense
??
is this function ok??Code:void *(char *str)
{
int i;
for(i=0;str[i];i++)
if(str[i]=='i')
if ((!i)||str[i-1]==' '||(i==strlen(str)-1)
{
strcpy(str+i,(str+i+1));
i--;
}
}
i mean logickly
if you fix compilation errors this function will removes spaces that follow character 'i'.
Is it logical?
yes but i dont have a compiler in my exam
so can you tell me if its ok?
how to do it
if you dont have a compiler
?
Do your best and double check your work. Even if you are very good, you can make a mistake, but that's okay, since the other people taking the exam will be facing the same problem.Quote:
Originally Posted by transgalactic2
i cant understand some of the if statement
why ''i" could to be null
why we copy one string into another when
the first string is smaller by size
it cannot be
??