answersLogoWhite

0

It depends whether you are writing a header or a source file. Generally you will begin with the header, and this should always begin with a header guard:

// file: my_header.hpp

#ifndef _MY_HEADER_HPP_

#define _MY_HEADER_HPP_

//...

// header code goes here

// ...

#endif _MY_HEADER_HPP_

Although the opening header guard should always be placed first, it's a good idea to precede the header guard with a multi-line comment briefly explaining the purpose of the header and its contents, as well as the author's contact details and any required copyright notifications.

The header code will include any other required headers as well as any required forward declarations, followed by its own declarations. You may also include definitions for those declarations, however its generally best to keep implementation details separate from the declarations. The only exceptions are when declaring class templates, which must be completely defined in the header, or when defining implicit inline functions.

The corresponding source file must include the header file, along with any other header files for its forward declarations, before defining the implementations of the header's undefined declarations. Other files that require those definitions need only include the corresponding header file.

User Avatar

Wiki User

12y ago

What else can I help you with?

Related Questions

Do I need random picture generator coding in c plus plus?

No.


How can you view page by page output in c plus plus?

Pipe the output to the MORE command.


How do you create a game library for a c plus plus compiler used for 3D sonic the hedgehog games?

You would have to use coding.


What is c plus plus coding used for?

C++ is used in virtually every field of programming, including gaming and multimedia, financial, scientific and industrial applications, as well as low-level subsystem programming.


Coding constants in c?

Coding constants in c means writing the constants in a certain way that the c language understands.


Which word is reserved in c plus plus?

All C++ keywords are reserved, as are all variable and function names that begin with two leading underscores.


Can anyone provide me with a C plus plus coding for hotel reservation system using data file handling?

That cannot be answered here; there are commercial packages to do this, which you can locate on the Internet.


Coding in c plus plus to swap two nos using pointer?

void swap (int &pa, int &pb) { *pa ^= *pb; *pb ^= *pa; *pa ^= *pb; }


What are the Advantages of c over c plus plus?

There are no advantages of C over C++ as such. Everything you can do in C you can also do in C++. However, by taking advantage of C++ object oriented programming, generic programming and template meta programming as well as C-style coding, you can produce more efficient machine code far more easily and more quickly than with C alone.


Where can one learn more about printf?

Wikipedia offers a great article about printf. They even provide samples of coding that is used in programs. If further assistance is needed try the website C Plus Plus.


What is b plus b plus b plus c plus c plus c plus c?

b+b+b+c+c+c+c =3b+4c


What is c plus c plus 2c plus c plus c equal?

c + c + 2c + c + c = 6c