Code:
#include <stdio.h>
#define AL 100
#define SL 32
int main(){
char array[AL][SL] = { "at", "be", "funzey", "zebra" };
int i,used = 0;
//i want to find out how much of the array is in use.
for(i=0;i<AL;i++){
if(array[i][SL]!=NULL){
printf("Slot #%i = %s\n",i,array[i]);
used++;
}
}
printf("Slots used: %i\n",used);
printf("Slots remaining: %i\n",AL-used);
return 0;
}
OUTPUT:
Slot #0 = at
Slot #1 = be
Slot #2 = funzey
Slots used: 3
Slots remaining: 97
Codepad is pretty nice, though. You can edit my code, compile it and run it without leaving the page.