complete function definition i.e. atoi
I am using MACOSX but since is UNIX (Darwin) based etc. and the forum has not other suitable place I am writing my problem here.
I would like to find the code where complete function definition is placed for different functions i.e. atoi.
I am able to understand that to use the atoi I need to define the stdlib.h in the top.
#include <stdlib.h>
mainly because of this I searched through the shell $ find . -name "stdio.h"
and I found but... when I go inside I can find only this:
int atoi(const char *);
And what actually I would like to find is this:
[tag]
Code:
/* atoi: convert s to integer; version 2 */
int atoi(char s[])
{
int i, n, sign;
for (i = 0; isspace(s[i]); i++) /* skip white space */
;
sign = (s[i] == '-') ? -1 : 1;
if (s[i] == '+' || s[i] == '-') /* skip sign */
i++;
for (n = 0; isdigit(s[i]); i++)
n = 10 * n + (s[i] - '0');
return sign * n;
}
[/tag]
Any help please? How I can achieve this etc.?
Thanks!
Btw. I am newbie!