2
My code performs double loop for
and no longer executes even what I put after the function call stringToUpper()
within the main()
, or what I put after the loop for
.
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
void stringToUpper(char str[]){
for(int i = 0; i<strlen(str); i++){
if(str[i]>=97 && str[i]<=122){
str[i] = str[i] - 32;
}
}
printf("%s\n", str);
}
int main(){
stringToUpper("All your BASE are Belong to US!");
return 0;
}
Thank you so much for the feedback, @Maniero. I would also like to know why it stops the code in the middle of the loop for.
– Luca2453
It’s written in the first sentence of the answer.
– Maniero