The mechanism of scanf is that the format requirement must be consistent with what you input. Your format requirement is name=[a string][blank character]num=[integer]
So you enter name =Lili num=1001, at this time Lili goes into the array name, and 1001 goes into the integer variable num.
What should be noted here is that [whitespace characters] are not just spaces, but also newlines\n, tabs\t and other characters that can be considered whitespace characters in C language. You can try it by typing name=Lili and press Enter and num=1001 and press Enter, and the result will be the same.
Also mentioned is that the scanf string ends when it encounters a blank character.
For example, when typing "i have a dream", scanf thinks it is four strings, not one!