The code dump happens because you are accessing a pointer which is not initialized . "current" should be initialized to a valid memory location before trying the De - referencing it . more cleaner code would be
#include<iostream>
using namespace std;
int max=3;
struct node
{
char *ptr;
};
struct node* start = new node();
struct node* current = start;
void init()
{
current->ptr = (char*)malloc(max*sizeof(char)); //ERROR IN THIS LINE.
}
void add(char page)
{
char *c;
c = current->ptr;
if (page == *c)
cout << "Yes";
else
cout << "No";
}
void main()
{
init();
add('a');
cin >> max;
}