This is what I just wrote, why there will be a Chinese garbled, strives for the great god help me, thank you!
CodePudding user response:
https://blog.csdn.net/weixin_42109012/article/details/95747576? Utm_medium=distribute. Pc_relevant. None - task - blog - BlogCommendFromMachineLearnPai2-2. Nonecase& Depth_1 - utm_source=distribute. Pc_relevant. None - task - blog - BlogCommendFromMachineLearnPai2-2. NonecaseGive you a address baidu many
CodePudding user response:
Because you don't have the assignmentCodePudding user response:
Use the scanf to word input, word stored in an array of content is uncertain, printf from word began to output until the end of the empty character \ 0, so may be garbled words,CodePudding user response:
Taking a full==I have never see codeCodePudding user response:
I have just found the problem, not the scanf input, between 6 to 7 line I add a the scanf (" % s ", the word, 30)CodePudding user response:
Char [30] word={0};CodePudding user response:
"Hot" word corresponding XCCCC hexadecimal code is 0, and an array of word with no initialization, so the default value is 0 XCCCodePudding user response:
May be wrongCodePudding user response:
Not initialized, then word array element is a random value, so the garbled words are normal, and period of errors may occur (because may access unreadable memory), because strlen () led to the illegal memory access,CodePudding user response:
You don't have to word input, and not initialize the word variable, the statement of course,Good habit is a variable definition after initialization immediately!
Char word [30]={0};