char *a[] = { "11", "23", "", "44", "11", "", "16", "36", "", "51", "71", "", "46", "26", "", "14", "68", 0}; int sentinel = 0; int i = 0; while ( *(a + i++) != sentinel ) { /* counting away */ } int aLength = i; // 18, length int aUbound = i - 1; // 17, index of last element int aMaxIdx = i - 2; // 16, index of last element where a[i] doesn't cause seg fault // You now have the lengths so read like normal
You need to create an account or log in to post comments to this site.