I\'m attempting to create my own atoi function. With the following I\'m getting a return value of 0. Whatever I change the number variable within the function is what I get
As I thought, the problem is in your call.
Change your main to.
int main()
{
char number[MAXSIZE];
int num;
printf("Please enter a number:\n");
scanf("%s", number);
num = atoi_me(number);
printf("%d", num);
return 0;
}
Other than this it's not a good idea to use scanf - http://c-faq.com/stdio/scanfprobs.html . In this case you should use fgets.