Well, I'm assuming you're using this because you want to pass a character to a text function.
The answer is yes, you must pass an array. The reason is, the text functions take the address of the first character -- so they don't know when a string exds, except by the addition of the extra character -- the NUL character -- at the end of the string. So every string with one "real" character is really 2 chars long.
It's not that hard to do what you want, you can just do something like this (assume theChar is already initialized to the char you want):
Code:
char buff[2];
sprintf((char *) &buff,"%c",theChar);
function((char *) &buff);
Of course, this is exactly equivalent to:
char buff[2];
buff[0] = theChar;
buff[1] = 0;
function((char *) &buff);
You can pass the address of a single character SOMETIMES, but *only* if:
1) One of the parameters specifies the number of characters to operate on.
2) You know that the byte of memory immediately following your character is zeroed.
Case 1) happens if you use commands that work on parts of a string, and case 2) happens in a few ways, but the easiest is if your char is part of a struct or object -- then you know what variable immediately follows it in memory, and if you know this is zero, you can use it.
Even in these cases, however, you may simply want to allocate the buffer and do the above -- it's fastest and safest.