Skip to content

Maybe use sscanf? #42

Open
Open
@AndrewChe7

Description

static int my_atoi(const char *c) {

for atoi function really hard to check errors, because it returns integer for input params, so you can't check it for bad input. You can use sscanf(buf, "%d", &n) to get integer from string and return value will be != 1 if there is problems.

Metadata

Assignees

No one assigned

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions