jingo
jingo

Reputation: 1074

Strange (for me) declaration of function

What that declaration means in C ?

void help_me (char *, char *);

I'm newbie, but I know about pointers. Seems like this is something different ?

Upvotes: 0

Views: 126

Answers (3)

sverre
sverre

Reputation: 6919

This declaration says that help_me is a function taking two pointers to char (for example, two strings).

For a function prototype declaration the variable names are optional: void help_me (char *, char *); and void help_me (char * foo, char * bar); are equivalent.

Upvotes: 5

Fredrik Pihl
Fredrik Pihl

Reputation: 45644

It's a prototype, and in a prototype only the type of arguments are needed, i..e you don't need to state something like:

void help_me (char* a_char, char* another_char);

Upvotes: 2

freespace
freespace

Reputation: 16701

It's a prototype for a function. It doesn't give the argument names because it isn't strictly require in a prototype.

Here it is declaring that there exists a function, help_me that takes 2 arguments both of type char * and returns nothing.

Upvotes: 3

Related Questions