((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.
Thaaaaaaaaanks A lot bro.
you are awesome..
SO i need to use a code to help me to know the size of the array at first ..then i must declarate it as int *o=new int[size]; ..before using it ?