
Implement gm_strtol, your own strtol, which converts the start of a string into a signed long for a chosen base, then writes back the address of the first character it could not convert.
long v = gm_strtol("0x1A rest", &end, 0); /* v, end-str */Expected result
26 off=4For your own tracking. Tests grade your code.
long v = gm_strtol(" -17abc", &end, 10); /* v, end-str */Expected result
-17 off=5long v = gm_strtol("zzz", &end, 10); /* v, end-str */Expected result
0 off=0Expected files
strtol.cAllowed functions
None. Write every helper yourself.
Allowed headers
Standard C library
Implements the contract of a function from the standard C library.

v0.40: Create exercises. Challenge the community.
Meet Studio →Implement gm_strtol, your own strtol, which converts the start of a string into a signed long for a chosen base, then writes back the address of the first character it could not convert.
long v = gm_strtol("0x1A rest", &end, 0); /* v, end-str */Expected result
26 off=4For your own tracking. Tests grade your code.
long v = gm_strtol(" -17abc", &end, 10); /* v, end-str */Expected result
-17 off=5long v = gm_strtol("zzz", &end, 10); /* v, end-str */Expected result
0 off=0Expected files
strtol.cAllowed functions
None. Write every helper yourself.
Allowed headers
Standard C library
Implements the contract of a function from the standard C library.

Run the tests to grade your code
Build your code, then check each test here. Open a result to inspect its output.