howdy,
this code is a random letter game, it selects a letter at random then gives the user 10 chances to guess. i have not implemented th do/while loop to allow for all 10 guesses.
my question is:
this code compiles with no errors and executes all of the way through about half the time. the rest of the time it executes all of the way through and issues a segmentation fault error.

Code:
#include <iostream>
#include <stdlib.h>
#include <time.h>
#include <string.h>

void guess (char* letter);

using namespace std;
int main ()
{
  system("clear");
  char  alphabet[][26] = {
   {'a','b','c','d','e','f','g','h','i','j','k','l','m','n','o','p','q','r','s','t','u','v','w','x','y','z'},
  {'A','B','C','D','E','F','G','H','I','J','K','L','M','N','O','P','Q','R','S','T','U','V','W','X','Y','Z'}
};

srand(time(0));
{
    int u_l = (rand()%2);
    int alph_answer = (rand()%26);
    char alpha_rand = alphabet[u_l][alph_answer];
  cout<<"Random letter: "<<alpha_rand<<endl;
  
  guess(&alpha_rand);
	
  } 
   return 0;
  }

  void guess (char* letter)
  {
  char* alpha_guess;
  int guess_num = 1;
  unsigned int result = 0;
  cout<<"I am thinking of a letter\n";
  cout<<"it could be upper or lower case\n";
  cout<<"I'll give you 10 trys to guess what it is\n";
  cout<<"Take a try.\n";
  int g;
  int i;
 
 cin>>alpha_guess;
  i = *letter;
  g = *alpha_guess;
 cout<<"Guess: "<<g<<endl;
 cout<<"Letter: "<<i<<endl;
 // result = (strcmp (alpha_guess, letter));
  cout<<"Result: "<<result<<endl;
  if(i != g)
  {
    cout<<"Wrong! Try again.\n";
    cout<<"you've guessed: "<<guess_num<<" times"<<endl;
    cout<<"you have: "<<(10 - guess_num)<<" trys remaining"<<endl;
    guess_num++;}
else
  cout<<"Correct! you got it in: "<<guess_num<<" guesses"<<endl;
}

what could the problem be?

thanks
M.R.