I'm setting up a program in C that manipulates strings where a user enters the number of transitions and cells, along with a string they wanted to manipulate and a starting a string and an "initial string"
The user will input the information line by line, so I decided to use "scanf", however, all my variables seem to work except for the integer of transitions, in which it's constantly being assigned 0 despite the user input.
int main()
{
int num;
int changes;
char string[10];
char startingString[25];
scanf("%d", &num);
scanf("%d", &changes);
scanf("%s", string);
scanf("%s", startingString);
printf("number: %d\n",num);
printf("Changes: %d\n",changes);
printf("String: %s\n",string);
printf("String Before: %s\n", startingString);
}
input:
20
10
teststring
goodbye
output:
20
0 <----
hello
goodbye