Is the gas cost the same if i use 3 different arrays or if i use a structure array which contains the 3 uint8 values together.
In your example, the three
uint8 would be packed into a single 32-byte word.
Notice the array:
Users public users;
So, you have
users, users, users[2} .... Each would return a single
struct that happens to contain 3x 8-bit
if i use 3 different arrays
To fetch or store 3, it would look something like:
uint8 a = no1; uint8 b = n02; uint8 c = no3;
uint8 is individually addressable and we had to do three ops to get all three. Each one is using an entire 32-byte word because that is the smallest unit of addressable space.
We also had to do it in three steps instead of one step. So, there will be more operations to step through it. By far, the most expensive ops will be the writes. The first way, using struct, prepares a single SSTORE to one "slot" (5-20K gas). The separate arrays technique prepares three SSTORE ops to three slots (15-60K gas).
Hope it helps.