Tagged: sscanf c example

sscanf and sprintf functions 19

sscanf and sprintf functions

sscanf() function is used to extract strings from the given string. Consider, char *str = “Learn C Online”; If we want to extract “Learn”, “C” and “Online” in a different variable then it can be done using sscanf function. Syntax: sscanf(characterArray, “Conversion specifier”, address of variables); This will extract the data from the character array according to the conversion specifier and store into the respective variables. sscanf() will read subsequent characters until a whitespace is found (whitespace characters are blank, newline and tab). Let us understand this using an example. char *str = “Learn C Online”; char *first, *second, *third;...

FREE C Cheatsheet - Speed Up Your C Programming.

FREE C Cheatsheet - Speed Up Your C Programming.

Download a 7-page free cheat sheet for easy and quick access to C Concepts, Snippets, and Syntax.

Thank you! Check you inbox and access your cheat-sheet