1

How to make this working? How to properly find the length of these 8 listings? Whenever I execute it gives me following error.

*passing argument 1 of ‘strlen’ from incompatible pointer type *

#include <stdio.h>
#include <stdlib.h>
#include <string.h>

int main(){

const char *listing[] = {"Name", "Date of birth","ID card number","Phone number","Address","Account","Fixing year","Deposit amount"};

    int inputLength = strlen(listing);
    printf("Here is length: %ld\n", inputLength);

    return 0;
}
0
int inputLength = sizeof(listing) / sizeof(char *);
0

Are you trying to store the total length of listings that is arrays of strings?

Or

Are you trying to store the number of bytes of listings

sizeof()

returns number of bytes for a data type.

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .