C - differentiate between 0 and \0 in integer array -
possible duplicate: nul terminating int array i'm trying print out elements in array: int numbers[100] = {10, 9, 0, 3, 4}; printarray(numbers); using function: void printarray(int array[]) { int i=0; while(array[i]!='\0') { printf("%d ", array[i]); i++; } printf("\n"); } the problem of course c doesn't differentiate between 0 element in array , end of array, after it's 0 (also notated \0). i'm aware there's no difference grammatically between 0 , \0 looking way or hack achieve this: 10 9 0 3 4 instead of this 10 9 the array this: {0, 0, 0, 0} of course output still needs 0 0 0 0. any ideas? don't terminate array value in array. you need find unique terminator. since didn't indicate negative numbers in array, recommend terminating -1 : int numbers[100] = {10, 9, 0, 3, 4, -1}; if doesn't work, consider: int_max , or int_min . as last resor...