what is the behaviour of C and C++ compiler for the below
statements.
int *p;
p = malloc(100);
Is the behaviour same ? or different ?
Answer Posted / 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 |
Post New Answer View All Answers
What do you mean by function pointer?
Differentiate between C and C++.
Differentiate between a template class and class template in c++?
What is an associative container in c++?
Can we use struct in c++?
Can non-public members of another instance of the class be retrieved by the method of the same class?
What is implicit pointer in c++?
Why c++ is called oop?
Why pointer is used in c++?
How do I make turbo c++ full screen?
What is virtual base class?
Why is it necessary to use a reference in the argument to the copy constructor?
What is this pointer in c++?
How can I learn c++ easily?
what is Loop function? What are different types of Loops?