The problem with candy bars is that they are very high in sugar. Although that will give you energy in the short run, high sugar foods cause an insulin spike which actually lowers blood sugar levels and makes you feel more tired afterwards. You want as much complex carbohydrates as possible, which will give you sustained energy, and moderate amount of fat, which is filling and an essential nutrient limited in nature (For purely survival situations, you'd probably want more fat).

Most candy bars(and many other processed foods) also have partially hydrogenated oil, which is very unhealthy and really should be banned, but I guess that's a bit off topic.