The extension of a file containing a C program can be any extension, so long as the compiler or platform can infer the proper rules to build it. Commonly, for C programs, the extension is .c, so myfile.c would be a C program. The term cpp is not a designation for C++. It means C Program Precompiler, and it is the normal way to build one or more C programs into an executable. Over the years, cpp has evolved into being able to handle all sorts of languages. C++ is one of them. Typical extensions for C++ programs are .cc, .cpp, and .cxx.
for c language it is .c and for c++ it is .cpp
The .cpp extension is merely conventional; it is not required by the C++ standard. You can actually use any file extension you wish.
find . -iname '*.c' -o -iname '*.cpp'
from the extension of your file.If it has an extension of .cpp then it is a c++ programIf it's extension is .c, then it is a C program.
.h for headers, .cpp or .cc for sources
All C++ source code is is a text file with the .cpp extension. So if you save your code as *****.cpp then it is automatically C++ source code.
Yes because a program can run without a CPP extension, especially if program extension is .exe
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.
You would first need to obtain a C compiler. If you know C, you could compose it in Notepad and give it the .c extension (or C++ and give it the .cpp extension) if you wanted to. However, you would need a compiler if you wanted to compile the program and run it.
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.
Not sure what you mean by "new" headers. You probably mean the C++ standard library headers, however these headers have been in existence since before 1998 when the language first became standardised. Prior to that, C++ used the C standard library headers, all of which have a .h extension. The C++ standard library headers have no file extension.
Answer1. When you save file using extension ".c" the program executes using "C" compiler and it cannot execute any other program which is not in "C".So, we cannot execute program in "C" which is not in "C".2. When you save file using extension ".cpp" the program executes using "C++" compiler and it can execute program of "C" but it should be saved with extension ".cpp".So, There is a program which is not in "C++" can be executed in "C++" compiler.Another answerYour question is ambiguous. 1. Okay in C++ but not in C:int main (void){ cout