I am almost completed the program. But issue in my environment with function call with call by value. Same function definition behaving differently. I think its problem with my environment. I am posting the executable file. Check it and if its working fine in your environment. I will post source code after your feed back.
Meanwhile I am working to resolve the issue.