I am having following union and I have a function When i compile this code it is giving following error Answer You are failing to access a field of the indexed union array: mydata[0] is a value of type union data, and can’t be cast to uint64_t. You need to access the proper union member: to select the uint64_t value.