Hi all!
I'm going through tutorial exercises in a textbook and I'm stuck with something I'm sure should be simple!
I need to show the percentage of capacity used by the string in the array but it just won't work!
If anybody can offer any adviced I'd be very grateful!
Code:#include <stdio.h> #include <string.h> #define ARRAYSIZE 20 int main(void) { char a[ARRAYSIZE]; printf("\nEnter some text: "); gets(a); printf("\nYour string is %d characters long", strlen(a)); printf("\nThis string occupies %d percent of it's array's capacity", strlen(a) / ARRAYSIZE * 100); return 0; }