1. ## Code Compacting

ok this is a very easy one that i just cant really get my head around at this late hour of the nite. i simply want to compact this code so as it will fit on the screen over maybe 2 or 3 lines. heres the code:

Code:
```      if(((fptr->code[a][0] >= '0') && (fptr->code[a][0] <= '9')) && ((fptr->code[a][1] >= '0') && (fptr->code[a][1] <= '9')) && ((fptr->code[a][2] >= '0') && (fptr->code[a][2] <= '9')) && ((fptr->code[a][3] >= '0') && (fptr->code[a][3] <= '9')))
{
check = TRUE;
}```

i basically want it to look like this:
Code:
```if(((fptr->code[a][0] >= '0') && (fptr->code[a][0] <= '9')) &&
((fptr->code[a][1] >= '0') && (fptr->code[a][1] <= '9')) &&
((fptr->code[a][2] >= '0') && (fptr->code[a][2] <= '9')) &&
((fptr->code[a][3] >= '0') && (fptr->code[a][3] <= '9')))
{
check = TRUE;
}```
thanks for everyones help.

2. Actually, you solved the problem yourself
The second code should work.

Consider this simple example (which compiles without error)
Code:
```#include <stdio.h>

int main()
{
int a = 0;
int b = 0;
if (a == b && b == a &&
a == b && b == a &&
a == b && b == a)
printf("Success");
return 0;
}```

3. Congratulations, you've answered your own question by hitting enter once in a while. So what again was your question?

Quzah.

4. thanks so much, i thinks i might need some sleep very soon.

Code:
```for (i=o;i<4;i++:)
{
if ((fptr->code[a][i]>= '0') && (fptr->code[a][i]<='9'))
check=true;
};```

6. Let's see...
Code:
```if( isdigit( code[a][0] ) && isdigit( code[a][1] )
&&  isdigit( code[a][2] ) && isdigit( code[a][3] ) )```
Ok, some one else's turn.

Quzah.

7. My earlier code isn't correct because it would give a true result even if not all conditions were met.
Code:
```for (i=o;i<4;i++:)
{
if ((fptr->code[a][i]>= '0') && (fptr->code[a][i]<='9'))
check=TRUE;
else
{
check=FALSE;
break;
}
};```

8. Originally Posted by Quantum1024
My earlier code isn't correct because it would give a true result even if not all conditions were met.
Code:
```for (i=o;i<4;i++:)
{
if ((fptr->code[a][i]>= '0') && (fptr->code[a][i]<='9'))
check=FALSE;
else
check=FALSE;
};```
1) That's the letter o, not the number 0. ( "Oh", not "Zero" ) Which in this case, had better be variable declared some place, otherwise this won't compile. But I'll assume it's a typo, and that you meant zero.

2) So now instead it always returns FALSE.

3) This semi-colon isn't needed.

4) Your edit beat my post, in which you corrected bullet point #2.
[/edit]

Quzah.

9. LOL I need to sleep too