You mean when linking your files? It is possible to share one global variable, if you declare it in every cpp file that uses it. You must declare all of them but one as extern.
Code:
extern int MyVar;
To check if a memory allocation was successful, check if the pointer differs from NULL. If it equals to NULL, it failed.
Code:
int* MyVar;
MyVar = new int;
if(MyVar != NULL)
{
   //Do stuff

   delete MyVar;
}
else
{
   cout << "Failed!";
}


int* MyArray;
MyArray = new int[1024];
if(MyArray != NULL)
{
   //Do stuff

   delete[] MyArray;
}
else
{
   cout << "Failed!";
}
(notice the [] on delete when deleting an array)