Basically I am totally confused on how to pass a char, which is given by the user, and then store it and pass it to another function by reference.

pass it the same as anything else

void foo(char *c)
{

}

int main()
{
   char c = 'A'
   foo(&c);
}

pass it the same as anything else

void foo(char *c)
{

}

int main()
{
   char c = 'A'
   foo(&c);
}

So if its a user input then it would look something like

void foo(char *c)
{

}
int main()
{
      char b;
      printf("Enter a character: ");
      scanf("%c", &b); 
      foo(&b);
}

If you know the answer in line 9 what makes you think it would be any different on line 10? Afterall, both lines 9 and 10 are passing the char variable by reference to the functions.

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.