In what language? C?
After a bit of research, it looks like often IPv4 is often just stored as a char*. (For instance, have a look at this.)
If I would want to store the IP address not as a C-string, I'd create a similar structure in C:
typedef struct
{
unsigned char f0;
unsigned char f1;
unsigned char f2;
unsigned char f3;
} IPv4;
where f0, f1, f2, f3 represent the 4 fields of the IPv4 address separated by dots.
Alternatively, you can just do a
unsigned char[4];
array as well. An unsigned char can store values from 0 to 255, exactly the range of the IPv4 address fields.
It all depends on what suits you best.