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

Can I have a reference as a data member of a class? If yes, then how do I initialise it?

704


How static variables and local variablesare similar and dissimilar?

558


Describe linkages and types of linkages?

565


When is the destructor called?

604


Is swift faster than c++?

563






Can a program run without main?

628


If dog is a friend of boy, is boy a friend of dog?

571


You have two pairs: new() and delete() and another pair : alloc() and free(). Explain differences between eg. New() and malloc()

589


What is polymorphism & list its types in c++?

621


Why is c++ is better than c?

514


Where is atoi defined?

580


write a corrected statement so that the instruction will work properly. if (4 < x < 11) y = 2 * x;

1510


What are the uses of pointers?

579


What is the difference between struct and class?

739


How can a called function determine the number of arguments that have been passed to it?

655