• Open Menu Close Menu
  • Apple
  • Shopping Bag
  • Apple
  • Mac
  • iPad
  • iPhone
  • Watch
  • TV
  • Music
  • Support
  • Search apple.com
  • Shopping Bag

Lists

Open Menu Close Menu
  • Terms and Conditions
  • Lists hosted on this site
  • Email the Postmaster
  • Tips for posting to public mailing lists
Function definitions
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Function definitions


  • Subject: Function definitions
  • From: Jonathan <email@hidden>
  • Date: Sat, 08 Apr 2006 15:44:18 -0700
  • Thread-topic: Function definitions

Hi--

I'm having a hard time getting my head around one of the concepts in C. If a
function is already defined in the header file, why does it need to be
defined again in the .c?

For example, if I put this in the header file:

int sum (int value1, int value2);

Why do I need to restate it when defining the function implementation again
in the .c:

int sum (int value1, int value2)
{
  return (value1 + value2);
}

Isn't one or the other just superfluous?

Best,
Jonathan


 _______________________________________________
Do not post admin requests to the list. They will be ignored.
Cocoa-dev mailing list      (email@hidden)
Help/Unsubscribe/Update your Subscription:

This email sent to email@hidden

  • Follow-Ups:
    • Re: Function definitions
      • From: Ondra Cada <email@hidden>
    • Re: Function definitions
      • From: Alan Hart <email@hidden>
    • Re: Function definitions
      • From: Robert Martin <email@hidden>
  • Prev by Date: Re: NSArrayController - limiting number of values
  • Next by Date: Re: NSArrayController - limiting number of values
  • Previous by thread: Re: CoreData stationary documents
  • Next by thread: Re: Function definitions
  • Index(es):
    • Date
    • Thread