this is one of the k&r exercises that ive been stuck on. i was trying to do this manually and not using a stdio.h function. i wasnt aware this function existed. and may i add k&r doesnt assign exercises very well. i guess they expect you to already know whats out there. the use of pointers wasnt discussed and yet i had to figure out the basics of them and use it to do an exercise.
unsigned int htoi(char *s);
for (i = 0; i <= (10 -1) && (c = getchar()) != EOF && c != '\n'; i++)
s[i] = c;
//do i need to add a '\n' and a '\0' here? or will this suffice and put the '\0' at the end?
unsigned int htoi(char *s)
unsigned int n;
r = sscanf(s, "%x", &n);