answersLogoWhite

0


Best Answer

Source files use a .cpp file extension, while headers use .hpp. However, this is merely a convention. Most C++ programmers use .h for all headers, even though this convention implies a C-style header rather than a C++ header. Ultimately, the extension is immaterial. If the file can be included in other files, then it is a header, otherwise it is a source file.

User Avatar

Wiki User

10y ago
This answer is:
User Avatar
More answers
User Avatar

Wiki User

11y ago

CPP is an abbreviation of C Plus Plus. It's simply a convention used to differentiate between C and C++ source code files. HPP is the equivalent of a C++ header file, although most people continue to use H files for this purpose. Note that there is no specific requirement to use either extension -- you can use whatever extensions make the most sense to you -- however CPP is universally understood to denote a C++ source file and should be used whenever sharing C++ code.

This answer is:
User Avatar

User Avatar

Wiki User

11y ago

Most C programmers use a .c file name extension for executable C source code, and .h or no filename extension at all for source files containing definitions and interface specifications, so-called header files.

Some C compilers inspect the file name extension and draw conclusions, but most will accept almost any filename convention.

Other common filename extensions used in the C family of programming languages are .cpp and .hpp (C++) and .cs (C#). On operating systems with case-sensitive file names, these extensions are generally expected to be in lower case.

This answer is:
User Avatar

User Avatar

Wiki User

10y ago

Programming with C++ is writing computer programs using the C++ programming language.

This answer is:
User Avatar

User Avatar

Wiki User

10y ago

The same as for any executable; typically .exe.

This answer is:
User Avatar

Add your answer:

Earn +20 pts
Q: Why we use extension as cpp in c plus plus programs?
Write your answer...
Submit
Still have questions?
magnify glass
imp
Continue Learning about Engineering

What c plus plus program must be saved in a text with the extension cpp?

The .cpp extension is merely conventional; it is not required by the C++ standard. You can actually use any file extension you wish.


Is g plus plus similar to c plus plus?

G++ is the Gnu compiler's extension for C++. It is not a different language. It simply allows you to use the GCC compiler to write C++ code.


What is computer program in c plus plus?

The C++ standard does not impose any extension rules on source code files. Conventionally, all C++ headers use a .h extension while all C++ source files use a .cpp extension, however you are free to choose your own extensions as you see fit. Some programmers prefer .hpp for C++ headers in order to differentiate them from C headers, however there's no requirement to do so unless you are specifically differentiating C-style headers from C++ headers. Similarly with .c and .cpp extensions with respect to C-style code and C++ code. In the main it's best to stick with the well-established conventions.


How do you open a C file as an executible file?

In a canonical C compiler, you type "cc (program file name).c (return) and it spits out "a.out", which is an executable. Works with the original Kernighan and Ritchie C compiler. For C++, use the .cpp extension and "g++" for the compiler: In a terminal window, on MacOS, 'cc (program name).c (return)' 'g++ (program name).cpp (return)' produces an executable named "a.out", which can be run. '-o (some file name . extension) will change the output file name.


What is the use of extension c holder?

An extension cord holder is used to hold an extension cord. It wraps around the holder, for easy release and withdrawal.

Related questions

What c plus plus program must be saved in a text with the extension cpp?

The .cpp extension is merely conventional; it is not required by the C++ standard. You can actually use any file extension you wish.


A program in c plus plus will run without an extension name CPP?

Yes. cpp is merely a convention to differentiate C++ source code from C source code, just as hpp is used to differentiate C++ header files from C header files (*.h). But they are just conventions, not rules: you can use any extension you like for both header and source files. For example, there's nothing to prevent you using the cpp extension for a header file. However, using the conventions makes it much easier to organise and recognise your files.


Why do you use a different extension for c and c plus plus programs?

Simply because they're different languages, C++ has a few more added components to it. If they were the same they would both be C wouldn't they?


Is there a domain lookup extension you can use in your browser?

Yes, there is a domain lookup extension that you could use in your browser. By downloading programs, you could quickly find that your extension is used in your browser.


A program that executes in c but not in c plus plus?

The logic to create such programs is very simple. We know that rules of programming languages. Among them the most important one is "We should not use keywords as identifiers". Based on this rule we can create many programs that execute in c but not in cpp. Suppose write a program to and two numbers. Store the two values in two variables, name the variables as class and object. then execute in c. it will produce the output, and do the same thing in cpp, it will give two errors. because we used keywords as identifiers in cpp. ex:-#include<stdio.h> #include<conio.h> void main() { int class=10,object=26,res; res=class+object; printf("%d",res); getch(); } Or: char str3[3] = "ABC"; /* doesn't compile in C */


What is the use of visual c plus plus?

It's primary purpose is to develop programs for the Windows platform.


Can you use blingee plus on Google Chrome?

Highly unlikely, as Google Chrome does not carry an app or extension for it.


Explain a program for this pointer in cpp?

Go to the link. You will got use of "this" keywork with simple explanation and example. http://cpp.codenewbie.com/articles/cpp/1527/Keyword_this-Page_5.html


Is g plus plus similar to c plus plus?

G++ is the Gnu compiler's extension for C++. It is not a different language. It simply allows you to use the GCC compiler to write C++ code.


How do you compile and run C plus plus programs on the Macintosh?

Use Xcode. See related links below.


What is computer program in c plus plus?

The C++ standard does not impose any extension rules on source code files. Conventionally, all C++ headers use a .h extension while all C++ source files use a .cpp extension, however you are free to choose your own extensions as you see fit. Some programmers prefer .hpp for C++ headers in order to differentiate them from C headers, however there's no requirement to do so unless you are specifically differentiating C-style headers from C++ headers. Similarly with .c and .cpp extensions with respect to C-style code and C++ code. In the main it's best to stick with the well-established conventions.


Why you use CPP in vinyl base ink for OPP substrate?

it gives adhesion on opp