How do you write a functions declaration?

This is a discussion on How do you write a functions declaration? within the C Programming forums, part of the General Programming Boards category; If I have this function.. Code: void push(void *value, void *stack) { //code } how do you write its function ...

  1. #1
    Registered User
    Join Date
    Sep 2008
    Posts
    58

    How do you write a functions declaration?

    If I have this function..
    Code:
    void push(void *value, void *stack)
    {
         //code
    }
    how do you write its function declaration?

    like this?
    Code:
    void push(void, void);

  2. #2
    ch4
    ch4 is offline
    Newbeer ch4's Avatar
    Join Date
    Jan 2007
    Posts
    142
    Code:
    void push(void *,void *);

  3. #3
    and the Hat of Guessing tabstop's Avatar
    Join Date
    Nov 2007
    Posts
    14,185
    You can do as ch4 mentions, but it is perfectly acceptable (and a good idea) to use
    Code:
    void push(void *value, void *stack);
    as your function prototype. (This way, just by reading the header, you can tell which argument does what.)

Popular pages Recent additions subscribe to a feed

Similar Threads

  1. Errors including <windows.h>
    By jw232 in forum Windows Programming
    Replies: 4
    Last Post: 07-29-2008, 01:29 PM
  2. Quantum Random Bit Generator
    By shawnt in forum C++ Programming
    Replies: 62
    Last Post: 06-18-2008, 10:17 AM
  3. Expression Manipulator v0.2 (bug fixes, functions)
    By ygfperson in forum A Brief History of Cprogramming.com
    Replies: 4
    Last Post: 05-26-2003, 04:52 PM
  4. Serial Communications in C
    By ExDigit in forum Windows Programming
    Replies: 7
    Last Post: 01-09-2002, 09:52 AM
  5. functions to write a file
    By subbuy2k in forum C++ Programming
    Replies: 1
    Last Post: 12-27-2001, 09:59 AM

1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21