> -------Original Message------- > From: Muhammed Suhail <[email protected]> > >> > >> Could you tell me why the following result comes up. > >> Question > >> Sscanf(" 1234567 ", "%5s%d", &s, &i) //yields s=12345,i=67 > >>
Please see https://golang.org/pkg/fmt/#Sscanf Sscanf uses the format specifier "%5s%d" when it scans the input string " 1234567 ". %5s is to be understood as %s represents the "un-interpreted" bytes of string 5 specifies the width As a result "12345" is assigned to s %d implies that the rest of the string fragment "67" is to interpreted as a integer. Consequently 67 is assigned to i. Now try to answer the following questions: 1. why we use &s and &i 2. what would be the output if the format specifier was "%s%d" warm regards Saifi.

