Thread: Novice question on header files

  1. #1
    Registered User
    Join Date
    Jun 2003
    Posts
    53

    Novice question on header files

    Ok,

    I've spent a good deal time in C, and I recall I often used .h or header files to store my global variables, structs, and other prototypes. I'm learning C++ now, and I've stumbled across header files in this book. I'm using Microsoft Visual C++ 6.0 Professional Edition for compiler purposes. The book says I can use .hpp instead of .h which I thought was kind of wierd..I remmeber c programs were .c and c++ are .cpp so does that follow where c headers .h and c++ header .hpp?? What do you guys use .h or .hpp which is more the style these days and which is more ANSI compliant? Any help would be greatly appreciated.

    Herns

  2. #2
    Code Goddess Prelude's Avatar
    Join Date
    Sep 2001
    Posts
    9,897
    >I remmeber c programs were .c and c++ are .cpp
    Not necessarily. Sometimes C++ files are suffixed with .cc, or .C. There's no required file extension, though .c and .cpp seem to be the most widely accepted. Likewise with header files, though .h is usually consistently used between C and C++ to make things simpler.
    My best code is written with the delete key.

Popular pages Recent additions subscribe to a feed

Similar Threads

  1. Checking array for string
    By Ayreon in forum C Programming
    Replies: 87
    Last Post: 03-09-2009, 03:25 PM
  2. Question about binary trees and files
    By satory in forum C Programming
    Replies: 9
    Last Post: 03-06-2006, 06:28 AM
  3. Header files
    By Jez_Master in forum C++ Programming
    Replies: 2
    Last Post: 04-08-2002, 07:56 AM
  4. Header files
    By borland_man in forum C++ Programming
    Replies: 14
    Last Post: 02-22-2002, 04:30 AM
  5. question about header files
    By ArseMan in forum C++ Programming
    Replies: 2
    Last Post: 09-21-2001, 02:33 AM