why c++ is not called strictly d super set of c?

Answer Posted / astha biswas

there are some key-words like class , new etc which can be
used as identifiers in c. so if we save program in .c using,
new as an identifier, it will not show any error; but if we
save the same program in .cpp, it will show error as new is
an operator in c++.

EX:

#include<stdio.h>
#include<conio.h>
void main()
{
int new;
clrscr();
new=3;
printf("%d",new);
}

if we execute this program in .c, output will be 3.
but if we execute this program in .cpp; then it will show 2
errors.
1. declaration terminated incorrectly.
2. lvalue required.

Is This Answer Correct ?    10 Yes 1 No



Post New Answer       View All Answers


Please Help Members By Posting Answers For Below Questions

What doescout<<(0==0) print out a) 0 b) 1 c) Compiler error: Lvalue required

764


Write a function that swaps the values of two integers, using int* as the argument type?

770


What are friend classes?

822


Define a pdb file.

817


What is pure virtual function? Or what is abstract class?

791






List down the guideline that should be followed while using friend function.

809


What is std :: endl?

773


What is struct c++?

731


What are advantages of using friend classes?

811


Can a program run without main function?

859


Assume studentNames and studentIDs are two parallel arrays of size N that hold student data. Write a pseudocode algorithm that sorts studentIDs array in ascending ID number order such that the two arrays remain parallel.

1943


What is a forward referencing and when should it be used?

813


what is COPY CONSTRUCTOR and what is it used for?

793


What do you mean by function overriding & function overloading in c++?

786


Explain the use of vtable.

812