Is there something that we can do in C and not in C++?
Answers were Sorted based on User's Feedback
Answer / dangling pointer
try this one
int *x=malloc(10);
it works in c but not in c++ reason is we will have to
explicitly cast in c++ to convert a void* to another type
to work.
Is This Answer Correct ? | 5 Yes | 0 No |
Answer / dheeraj sharma
in c we can assign we can assign void pointer to any type of
pointor varible without typecasting.,but we cant do it in
C++,because C++ does not allow type mismatch.
same case with enum also.in C we can assign integer to enum
member directly,but in C++ we have to typecast integer first
with enum variable.
Is This Answer Correct ? | 2 Yes | 0 No |
Answer / bhushan bastwade
We can have variable names as class,new,operator in C but not in C++ as they are keywords in C++.
For more have a look on this
http://www.geeksforgeeks.org/write-c-program-wont-compiler-c/
Is This Answer Correct ? | 2 Yes | 0 No |
Answer / achal ubbott
One important difference between c and c++ is that c
compilers are loosely coupled. So it does not perform type
checking that much strictly and can allow some conversions
which otherwise most c++ compilers would not allow.
Is This Answer Correct ? | 1 Yes | 0 No |
Answer / zarra
C++ will not allow declaration without initialization but C
will allow declaration without initialization.
And C++ and C both will not allow later initialization.
Is This Answer Correct ? | 1 Yes | 0 No |
Answer / guest
Theoratically it is being said that we cannot call main
recursively(main caling main) in c++, but practically it can
be done.
whereas in c, we can call main in main.
Is This Answer Correct ? | 7 Yes | 7 No |
Answer / faisal saifi
C++ retained all features of C programming in addition of
object oriented programming that use OBJECT and a CLASS so
there is nothing that happen in C but not in C++;
Is This Answer Correct ? | 2 Yes | 2 No |
Answer / shweta iyer
Yes. We can create class in C++ but cannot do so in C.
Is This Answer Correct ? | 0 Yes | 0 No |
Answer / som
In C the const variables can be declared and can allocate
the value later.
For ex:
const int i;
i = 7;
This will work in c, but c++ will give compilation error.
Is This Answer Correct ? | 0 Yes | 2 No |
Answer / prathap
every C program is execute in C++.
From the above reason we can understand that every thing in
C we have in c++ also.
so Answer is NOTHING
Is This Answer Correct ? | 1 Yes | 6 No |
Explain function overloading and operator overloading.
In how many ways we can initialize an int variable in C++?
a class that maintains a pointer to an object that is programatically accessible through the public interface is known as?
What is array in c++ pdf?
Why #include is used?
How important is c++?
class HasStatic { static int I; }; Referring to the sample code above, what is the appropriate method of defining the member variable "I", and assigning it the value 10, outside of the class declaration? a) HasStatic I = 10; b) int static I = 10; c) static I(10); d) static I = 10; e) int HasStatic::I = 10;
What is size of empty class object
How do you clear a set in c++?
Will the inline function be compiled as the inline function always? Justify.
What are the static members and static member functions?
What do you mean by pure virtual functions in C++? Give an example?