In C we have 2 main methods to convert strings to numbers i.e, Using string stream, Using stoi() library Function, and using atoi() library function.
- sscanf(): It reads input from a string rather than standard input.
- atoi() or stoi(): These functions takes a string literal or a character array as an argument and an integer value is returned.