You could use strtok() in combination with atoi(), or you could use sscanf(), or you could write your own integer string parsing code. (Ah, but if this integer is always a single digit, then tabstop's idea applies).Originally Posted by Graham Aker
emp is a pointer to struct integer. emp->digits is a pointer to int. *emp->digits is an integer. What you probably wanted to write was:Originally Posted by Graham Aker
The sizeof(*emp->digits) is preferred to sizeof(int) since it means that you will not have to change that in the event that the type of *emp->digits changes.Code:emp->digits = malloc(sizeof(*emp->digits) * arraysize);