From the Main you are calling the function fun and parameters are being passed by value. Fun is returning void so what ever the value you are passing to the function Fun that will be incremented by one and the scope of those values will be in the Fun.Incremented values will not be reflected in the main. To achieve that you need to pass the parameters by reference.