开发者

Strange (for me) declaration of function

开发者 https://www.devze.com 2023-04-09 23:51 出处:网络
What that declaration means in C ? void help_me (char *, char *); I\'m newbie, but I know about poi开发者_运维问答nters. Seems like this is something different ?This declaration says that help_me i

What that declaration means in C ?

void help_me (char *, char *);

I'm newbie, but I know about poi开发者_运维问答nters. Seems like this is something different ?


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.


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.


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);
0

精彩评论

暂无评论...
验证码 换一张
取 消

关注公众号