If you find yourself getting hungry or lacking energy when you are working out then you need to make sure you are structuring your meal times accordingly. Typically the size of the meal will determine how long you leave between eating and exercise. Some people do better waiting a couple of hours after eating before going to the gym whilst the more experienced exerciser can eat as close as 10 minutes before exercise.
It is best to experiment to find what times and portion sizes work the best with your body. The choice of fuel is just as important. Always include protein with carbohydrates to control the blood sugar response so your energy doesn’t crash before your workout.