I am having interesting issue here. If I run the following code program crashes. I just wanted to print the list using comma between elements... If you could please tell me whats wrong here, thatd be very nice of you :)
The first problem I see is that you are not initializing liter. Take a look at the example here on http://www.cplusplus.com/reference/list/list/push_front/ and see that the iterator is initialized as the beginning of the actual list. In your case, list<int>::const_iterator liter=A.begin();