I'm getting a segmentation fault when running this code. The time displays fine so I have no idea were the seg fault is coming from. If I don't assign 's' to temp2, and just print s, it works fine - but I need a string! LOL. any thoughts?

Code:
time_t current_time;
char *s;
struct tm *loc;
current_time = time(0);
loc = localtime(&current_time);


if( temp == "%t" )
		{
			strftime( s, 100, "%I:%M %p", loc );
			temp2 = string(s);
			cout << endl << temp2 << endl; //this runs fine
		}

and here is the whole function...still dirty though
Code:
void setPrompt( string newP )
{
	int modLoc = newP.find('%', 0); //location of %
	string temp, temp2;
	string txt;

	time_t current_time;
	char *s;
	struct tm *loc;
	current_time = time(0);
	loc = localtime(&current_time);

	if(modLoc == string::npos)
		prompt = newP;
	while(modLoc != string::npos)
	{
		if( modLoc>0 )
		{
			txt = newP.substr(0,modLoc-1);
			prompt.append(txt);
		}
		temp = newP.substr(modLoc, 2);
		//cout << endl << "--txt: " << txt <<"\n--temp: " << temp <<endl << "--newp: " << newP <<endl;
		if( temp == "%/" )
			prompt.append(PWD);
		if( temp == "%t" )
		{
			//temp2 = string(getenv("time"));
			//prompt.append(temp2);
			strftime( s, 100, "%I:%M %p", loc );
			temp2 = string(s);
			cout << endl << temp2 << endl;
		}
		if( newP.size() > (modLoc+2) )
		{
			newP = newP.substr(modLoc+2, newP.length());
			//cout << endl << "txt: " << txt <<"\ntemp: " << temp <<endl << "newp: " << newP <<endl;
		}
		else
			break;
		
		modLoc = newP.find('%', 0);
	}
	
		
}