#include <cs50.h>
#include <ctype.h>
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
int main(void)
{
string s = get_string("Enter a number: ");
string answer = 0
for (int i = 0, n = strlen(s); i < n; i++)
{
int min_value = 0;
for (int j = i; j < (n - i); j++)
{
min_value = s[i];
if (min_value > s[j])
{
min_value = s[j];
}
else
{
min_value = s[i];
}
}
answer[i]= min_value;
}
printf("%s", answer);
}
The program compiles, but I get a runtime error. What could be the issue? Been scratching my head for hours, can't figure it out. While trying to tackle this problem, I found a lot of holes in my understanding of arrays and strings, could someone explain that as well?