#include <stdio.h>
#include <stdlib.h>
#include <string.h>
#define SIZE_OF_RECORD 100
void main()
{
char lineBuffer[SIZE_OF_RECORD];
memset(lineBuffer, '\0', (SIZE_OF_RECORD - 1) * sizeof(char));
strcpy(lineBuffer, "testing"); strcat(lineBuffer, ','); //exception thrown here Exception thrown at 0x00007FFCB7B5D1CB (ucrtbased.dll) in PA_2.exe: 0xC0000005: Access violation reading location 0x000000000000002C.
printf("line buffer after assemble line \n%s", lineBuffer);
}
I do not understand. The string as it is declared should not be read only right? Why cant I change it?