OK, I am very confused!!!! ...This simply just doesn't make any sense to me......

NOTE: This is for university coursework, so please no answers about my code, or how to better code!!! ...All I want to know is why this section of code just "halts".... (it is for a coffeepot client / server application)

Code:
    for (z = 4; z < 13; z++){
      i = 0;
      while (milkTypes[i] != NULL){ printf("test\n"); i++;}
      i = 0;
      /* DID THE CLIENT SEND A MILK TYPE ADDITION? */
      while (milkTypes[i] != NULL) {
        printf("milk: %s\n", milkTypes[i]);
	if (strcasecmp(milkTypes[i], inToks[z]) == 0) {
          printf("found millk type\n");
	  /* found users milk type - Get the qty of milk requested */
	  for (y = 0; y < sizeof amountNumber / sizeof *amountNumber; y++) {
	    if ((strcasecmp(amountNumber[y], inToks[z + 1]) == 0) || (strcasecmp(amountVolume[y], inToks[z + 1]) == 0)) {
	      milkQty = y;
              printf("milk qty found\n");
	    }
            else printf("here1\n");
	  }
	}
	/* INCREMENT I READY FOR NEXT ADDITION */
	i++;
        printf("loop\n");
      }
      printf("finished milk\n");
output....

[code]
------------------------------------------------------------------
-- NEW CLIENT (127.0.0.1) HAS CONNECTED
-------------------------------------------------------------------
test
test
test
test
test
test
test
milk: Cream
found millk type
here1
here1
milk qty found
loop
milk: Half-and-Half
loop
milk: Whole-Milk
loop
milk: Part-Skim
loop
milk: Skim
loop
milk: Non-Dairy
loop
[code]

OK, there is an array called milkTypes (which stores the different types of milk the client can request)

The other arrays are amountVolumes and amountNumbers which are just arrays of strings to represent different levels of additions for a cup of coffee!

The last array is the array containing the tokenised request from the client!

Basically, this code is searching through the milk types array, then if it finds a milk type that matches the current token, it checks how much milk was requested by comparing the next token with strings in the amount volumes and numbers arrays!!!!

Basically, it does not exit this looop!!!!! WHY WHY WHY!!!!! - It never prints "finished milk".... this is soo strange, as i have tested that it exits the loop when the milk types array is null, and it does! (as you can see from the test loop and test output!) but it never continues on to the next section of code!!!!!!

If anyone has any ideas, any help advice is much appriciated!!!! ...Also, if you want to have the complete client and server programs, i can email them to you!!!! ([email protected])

Many thanks!!!!