Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]


Groups > comp.lang.c > #19243

Re: Function prototype inside function prototyp

From Ben Pfaff <blp@cs.stanford.edu>
Newsgroups comp.lang.c
Subject Re: Function prototype inside function prototyp
Date 2012-04-02 13:32 -0700
Message-ID <87wr5xvpr6.fsf@blp.benpfaff.org> (permalink)
References <2f93aa41-3f37-4670-9515-7a44f0eeb9ec@wb9g2000pbc.googlegroups.com>

Show all headers | View raw


Sam Hu <samhu.samhu@gmail.com> writes:

> I've never seen this until now:
>
> void thisworks(char c,int put(char ch,void* cl),void* cl)
> {
>       printf("This works!\n");
> }
>
> Why the function prototye int put(char ch,void* cl) can be in another
> function declaration void thisworks(....) and where can I get more
> information regarding this usage?

C99 says this:

     6.7.5.3  Function declarators (including prototypes)
...

8    A declaration of a parameter as ``function returning type''
     shall be adjusted to ``pointer to function returning type'',
     as in 6.3.2.1.

C89 said something similar, and I imagine that C11 does too.
-- 
Ben Pfaff 
http://benpfaff.org

Back to comp.lang.c | Previous | Next — Previous in thread | Next in thread | Find similar | Unroll thread


Thread

Function prototype inside function prototyp Sam Hu <samhu.samhu@gmail.com> - 2012-03-27 21:28 -0700
  Re: Function prototype inside function prototyp nick_keighley_nospam@hotmail.com - 2012-03-29 00:38 -0700
  Re: Function prototype inside function prototyp Ben Pfaff <blp@cs.stanford.edu> - 2012-04-02 13:32 -0700
    Re: Function prototype inside function prototyp Sam Hu <samhu.samhu@gmail.com> - 2012-04-04 18:13 -0700

csiph-web