hello
i have string array of variable size. could anyone let me know how to make sure that at the null terminater '\0' is at the end of the string
when i remove the line Buff[result] = '\0' i donot get any error during the execution of porgram. but with that line include i get the following error messageCode:here is code :#include <stdio.h> #include <math.h> #define SIZE 9 int main() { char Buff [ SIZE ] ; int result; result =SIZE + 1 ; Buff[result] = '\0'; Buff[result/2] = '|'; printf("%c\n\n\n",Buff[result]); return 0; }
runtime error #2 the stack around the variable Buff was corrupted