Firstly, that code shouldn't compile on a linux machine because linux compilers don't support conio.h. Secondly, the segmentation fault comes from the fact that you never point p to anywhere. This'll work better:
Code:
#include<iostream>
#include<stdio.h>
using namespace std;
class first{
public:
int a;
};
class second{
public:
second() { p = new first; }
~second() { delete p; }
void show(int x);
first *p;
};
void second::show(int x){
p->a=x;
cout<<(p->a);
}
void main(){
second s, *t;
t=&s;
t->show(2);
}