what is the behaviour of C and C++ compiler for the below
statements.
int *p;
p = malloc(100);
Is the behaviour same ? or different ?
Answers were Sorted based on User's Feedback
Answer / venu
we should explicitly typecast. Otherwise it is give a
compilation error.
| Is This Answer Correct ? | 3 Yes | 0 No |
Answer / pramodsingh_45
In "C" the implicit typecasting will be done from void* to
int* but in C++ we need to do explicit typecasting.
so in C++
p = (int*)malloc(100);
but in C
p = malloc(100) will also work.
| Is This Answer Correct ? | 2 Yes | 0 No |
What is polymorphism and its type in c++?
Are iterators pointers?
When there is a global variable and local variable with the same name, how will you access the global variable?
Does a derived class inherit or doesn't inherit?
What is istream c++?
Define the process of handling in case of destructor failure?
Should I learn c++ c?
How const functions will be treated by compiler?
How can a called function determine the number of arguments that have been passed to it?
What is difference between n and endl in c++?
What is a storage class? Mention the storage classes in c++.
Mention the ways in which parameterized can be invoked.