In this case you can divide the total size by the size of the first element:
num = sizeof(names) / sizeof(names[0]);
Careful though, this works with arrays. It won’t work with pointers.
In this case you can divide the total size by the size of the first element:
num = sizeof(names) / sizeof(names[0]);
Careful though, this works with arrays. It won’t work with pointers.