segment fault with the program

This is a discussion on segment fault with the program within the C++ Programming forums, part of the General Programming Boards category; I am receiving segment fault with this program
Code:
#include <iostream>
#include <new>
#include <cstdlib>
using namespace std;
class ar
...

2. since you don't have an assignment operator defined, you get a compiler defined assignment, so when you assign b = a the original pointer that b had is overwritten with the pointer from a. then at the end of your program when the desttructors are called, that pointer is released twice which can cause a fault. plus your original pointer from 'b' is lost and never deallocated.

you need to define an assignment operator that handles the transfer of pointers properly.