How do I determine rough opening sizes for common closet door sizes?
Bifold rough openings:  to the hinge (pivot ) side add 3/4", to the other other side, 1/4" 

So for single 24" wide door, a 25" RO (which is really a finished opening for bifolds) is needed. 

You need a bit more clearance on the pivot side, because the pivot is inboard a bit and it needs clearance to swing through (pivot around) the thickness of the door.  Similarly, any baseboard trim  will need to be held back from the inside (of the closet) for door clearance.