0
Why is it always false?
#include <stdio.h> int main() { char *str; int i = 0; int flows = 0; while (*(str + i) != '\0') { if ((int)(*(str + 1)) == 32) { if (*(str + i - 1) == *(str + i + 1)) flows = 1; else flows = 0; } i++; } if (flows) printf("true"); else printf("false"); return 0; }
1 ответ
+ 1
Dulgan Danjuma it happens more or less by random chance, depending on whatever happens to be in memory when and where you run this program. Notice the warning you get by running this on Sololearn. The pointer variable str is never initialized. You have to presume that str holds an unpredictable memory address that holds unpredictable values.