- Not allocating sufficient space in a character array to store the null character that terminates a string.
- Printing a "string" that does not contain terminating null character.
- Processing a single character as a string. A string is a pointer - probably a respectably large integer. However, a character is a small integer ( ASCII values range 0-255). On many systems this causes an error, because low memory address are reserved for special purposes such as operating system interrupt handlers. So "access violation" occurs.
- Passing a character as an argument to a function when a string is expected (and vice versa) is a compilation error.
- Not including the <string.h> header when using string functions from the string-handling library.
- Not appending a terminating null character to the first argument of a strncpy when the third argument is less than or equal to the length of the string in the second argument.
More Informative Posts: