New answers tagged

1

The function atoi returns an integer. You're assigning it to a variable of type char *. Change it to int key to fix.


0

Apart from the edits suggested by @AndyStevens, I would also point out that, You first need to verify whether k has only digits or not. Immediately type-casting string to integer using atoi without verifying whether each character is digit or not will fail some check50 test-cases


Top 50 recent answers are included