I think, You are looking for variable number of arguments. Go through the below post

http://stackoverflow.com/questions/1657883/variable-number-of-arguments-in-c