Original Post
Hi, I'm trying to pull together some code and was going to use arrays of function pointers for a few things. I was wondering what were the advantages and disadvantages of using them (in terms of speed). Example would be using different movement functions for updating game unit's x pos. Here's some code: for (int nLoopNo=0; nLoopNo < Unit.count; nLoopNo++) { int Unit[nLoopNo].x = ((*UpdateX[Unit[nLoopNo].MovementType])(Unit[nLoopNo].x)); } Would it be same speed, slower or faster than using if/else (considering it could be alot of units). Any thoughts would be greatly appreciated. Thanks.