((this code is a part of a big program which evaluate "The binary equivalent of the average"..
my program has a pointer which I declarate it as"int *p=new int[N];"
and when I declarate another pointer and use it ..i have this problem..!))

On line 4 you declare o as int *o=new int;. This ony gives you a single int pointer. So when you call line 16 you invalidate the pointer because you step out of the memory allocated to it. It looks to me like you need o to be an array. if you know what the size of o should be than make line 4 int *o=new int[size];, where size is the size of the array you need o to be. You are also incrementing c on line 17 but you never set c before you do that. You always want to set the value of a variable before you start using it.