-
Find space inside Array?
Hello, I'm trying to find the second space inside a array, here's my code:
Code:
Space=0;
PL=12; //came from another function that is working right!
PB=0;
// find PartB from start of numbers until 2nd space
while (Space!=2)
{
PartB[PB]=NewStr[PL];
if (PartB[PB]==" "){
Space++;
}
PB++;
PL++;
}
PartB[PB]='\0'; //close string
seams that any space is found then reach the end of the array then abort.
but HAVE more than 2 spaces in the string!
thanks!
-
Quote:
if (PartB[PB]==" ")
that's not right
Quote:
if (PartB[PB]==' ')
i think it should be like that
-
thanks m8! worked great! :D
-
i am just wanna tell you why did it work
in my code i am looking for the integer value that equals to space in the ascii table
not for the hall string " " that's cannot be done because you are trying to compare a constant string with a char type
[Warning] comparison between pointer and integer
if is there any thing wrong in my replay i hope you will fix it for me
i am just trying to be helpful because i am really love this site
-
thanks for your explanation! now I understand! :P