For example, does this code allow for the maximum size string that this array could store to be entered? (255 characters of input from scanf, and then leaving room for a null terminator to be added)
char string[256]
scanf("%255s", string);
Or does the scanf function automatically add the null terminator to the end of the input meaning that in order to allow for 255 characters plus a null terminator I would want to specify a width of 256 in the scanf function, like so?
char string[256]
scanf("%256s", string);
Any help would be appreciated, and this is my first question on S/O so if I have done something wrong please let me know! :)