Skip to content

Rank2, ft_atoi_base is wrong? #34

@fmontser

Description

@fmontser

I think this is wrong, what do you whink?

Seem that you are using atoi_base from piscine exercices, its not the same in the exam!

./a.out "Ceci permet de decouvrir le fonctionnement de ton ft_atoi_base." "16" 🗝 EXPECTED OUTPUT: 3308$

Seems that you are triming the string to the first valid part ("Cec" 0x3308), like the subject of the piscine. but the exam subject is different:

`
Write a function that converts the string argument str (base N <= 16)
to an integer (base 10) and returns it.

The characters recognized in the input are: 0123456789abcdef
Those are, of course, to be trimmed according to the requested base. For
example, base 4 recognizes "0123" and base 16 recognizes "0123456789abcdef".

Uppercase letters must also be recognized: "12fdb3" is the same as "12FDB3".

Minus signs ('-') are interpreted only if they are the first character of the
string.

Your function must be declared as follows:

int ft_atoi_base(const char *str, int str_base);
`

I think the whole string (where aplicable) must ve converted then manage any error (int ranges etc), i just failed the real exam on this, asked the staff but no luck, they wont answer...

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions