I've written something similar to this code for my answer to pset2 Substitution. The idea is to keep string s the same, but have a variable s_capital that converts s into uppercase. I can't work out why it's returning a segmentation fault after hours of searching around. Some help would be very appreciated :)
#include <stdio.h>
#include <cs50.h>
#include <string.h>
#include <ctype.h>
int main(void)
{
string s = "hello";
string s_capital = s;
for (int i = 0; i < strlen(s); i++)
{
s_capital[i] = toupper(s[i]);
}
printf("%s", s_capital);
}