I'm trying to write some code that will allow me to enter text of an arbitrary length. I think I need to use an array for this. Here's my code...
Code:
#include <stdio.h>
main()
{
char InputText[100]; /* Character Array setup */
printf("Hello, enter some text...\n this program uses \"inputText[100] to hold the text\" \n\n\t");
scanf("%s", &InputText);
}
It works, but not as I expected. I thought the number in square brackets dictated the number of characters that could be entered. However, the resultant program just seems to allow me to enter as much text as I like, no matter what number I place within the brackets!
Would some kind soul please explain (preferably in simple terms)