How do I use scanf to limit the user from entering a string no larger than the array?
What i've tried so far is:
#include<stdio.h>
int main()
{
const MAXSTRING = 5;
char arr[MAXSTRING] = {};
printf("Enter a string: \n");
scanf("%*s", MAXSTRING-1, arr);
return 0;
}
But this doesn't seem to work.