I am trying to modify a string in C language
char signal_cat[8];
if (k == 1) {
strcpy_s(signal_cat, "HPHA",6); //why cant I change char array (string) values???
}
else if (k == 2) {
strcpy_s(signal_cat, "Normal",6);
}
printf("Original signal category: %s \n", signal_cat);
When I run this it shows an exception "Unhandled exception at 0x7BEBF71D (ucrtbased.dll) in Lab3Parti.exe: 0xC0000005: Access violation reading location 0x00000006"
I have tried
signal_cat = "HPHA";
too, but an error shows "expression must be a modifiable lvalue"
Does anyone know how I can go about doing this?