/******************************************************************************
Welcome to GDB Online.
GDB online is an online compiler and debugger tool for C, C++, Python, PHP, Ruby,
C#, VB, Perl, Swift, Prolog, Javascript, Pascal, HTML, CSS, JS
Code, Compile, Run and Debug online from anywhere in world.
*******************************************************************************/
#include <stdio.h>
#include <string.h>
size_t arritems(char *checkArr[], size_t size) {
int count = 0;
for (size_t len = 0; len<size; len++)
if(checkArr[len] != NULL) {
count++;
}
return count;
}
int main() {
char *checkArr[1000] = {"This is very good",
"text that has been",
"put into a file for",
"the purposes of",
"being an example.",
NULL};
int size2 = arritems(checkArr,6);
printf("Check Array size: %d\n", size2);
char *checkArr2[1000] = {"This is very good",
"text that has been",
"put into a file for",
NULL,
"being an example.",
NULL};
int size3 = arritems(checkArr2,6);
printf("Check Array size: %d\n", size3);
char *checkArr3[1000] = {"This is very good",
"text that has been",
NULL};
int size4 = arritems(checkArr3,3);
printf("Check Array size: %d\n", size4);
char *checkArr4[1000] = {"This is very good",
"text that has been",
NULL,
"the purposes of",
"being an example.",
NULL};
int size5 = arritems(checkArr4,6);
printf("Check Array size: %d\n", size5);
return 0;
}