#include <cs50.h>
int main(void)
{
string str = "a";
str[0] = 'b';
}
I expected that this would modify the string str to make it "b". But this instead gives me a segfault at exactly the line str[0] = 'b'. Is this a quirk of the implementation of string in the cs50 library? If so, how can we modify a string after declaring it? Do we have to declare it explicitly as a char array?