알고리즘 19 - Convert a String to a Number!

tamagoyakii·2021년 10월 6일
0

알고리즘

목록 보기
19/89

Q.

We need a function that can transform a string into a number. What ways of achieving this do you know?

Note: Don't worry, all inputs will be strings, and every string is a perfectly valid representation of an integral number.

Examples
"1234" --> 1234
"605" --> 605
"1405" --> 1405
"-7" --> -7

A)

int string_to_number(const char *src) {
  return atoi(src);
}

0개의 댓글