Re: void * vs char *



In article <1174262593.153711.146610@xxxxxxxxxxxxxxxxxxxxxxxxxxxx>,
<Francine.Neary@xxxxxxxxxxxxxx> wrote:

So if a char * really is just a more functional void *, why would
anyone ever use a void * in their code, instead of a char *?

char * means that it points to characters or bytes. void * doesn't;
it means that it points to something of unspecified type. Even if
there was no functional difference between them, it would be
worthwhile to be able to express your intent.

-- Richard



--
"Consideration shall be given to the need for as many as 32 characters
in some alphabets" - X3.4, 1963.
.



Relevant Pages

  • Re: Strings and Characters
    ... > function that has a preset array of characters defined and it returns ... > char* readName (void) ... > store it as type char and return it to main. ...
    (alt.comp.lang.learn.c-cpp)
  • Re: Little console input problems
    ... void reset_istream ... char ch; ... // Reset the state. ... // Remove all characters until we find a newline or EOF. ...
    (alt.comp.lang.learn.c-cpp)
  • Re: easy way to evaluate this array
    ... void evaluate(unsighed char *pt) ... Put the values in a static array in the function, ... in some alphabets" - X3.4, ...
    (comp.lang.c)
  • Re: Recursively
    ... karthikbalaguru wrote: ... void f ... "Consideration shall be given to the need for as many as 32 characters ... in some alphabets" - X3.4, ...
    (comp.lang.c)
  • Re: Is continuum completely filled up?
    ... Therfore real line has void. ... distance from every other point mean that there are gaps? ... "Consideration shall be given to the need for as many as 32 characters ... in some alphabets" - X3.4, ...
    (sci.math)