Re: Use of Header files

  • From:
  • To:
  • Subject: Re: Use of Header files
  • Date: Wed, 26 Sep 2012 18:38:24 +0200 (CEST)

----- Original Message -----
> Hello all,
> What is the use of the header files?what happen if we don't include
> any header file?

C++ (and modern C) require that functions be declared before being used. In 
small projects, you can sometimes get away with just defining your functions 
(which also declares them). Stuff like

void foo()
{
}

int main()
{
  foo();
}

In larger projects, you'll want to use separate compilation (i.e., break up 
your code into multiple files). For instance, putting the above two into 
files foo.cpp and main.cpp. But if you do that, main.cpp no longer sees the 
declaration of foo. So you would need a foo.h containing a declaration of 
foo, and to have both foo.cpp and main.cpp #include "foo.h"

A+
Paul


Use of Header files

parul853 09/26/2012

Re: Use of Header files

paulf 09/26/2012

Compiler options for use with nVidia's CUDA SDK

Joseph Areeda 09/28/2012

Project Features

About this Project

CND was started in November 2009, is owned by DimaZh, and has 130 members.
By use of this website, you agree to the NetBeans Policies and Terms of Use (revision 20140418.2d69abc). © 2013, Oracle Corporation and/or its affiliates. Sponsored by Oracle logo
 
 
Close
loading
Please Confirm
Close