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
Is c++ low level?
What does new do in c++?
What function initalizes variables in a class: a) Destructor b) Constitutor c) Constructor
What language is a dll written in?
How do you save a c++ program?
What is general form of pure virtual function? Explain?
What are manipulators in c++ with example?
Does a derived class inherit or doesn't inherit?
Difference between Abstraction and encapsulation in C++?
Is facebook written in c++?
What is c++ code?
What is a breakpoint?
Difference between pointer to constant vs. Pointer constant
Evaulate: 22%5 a) 2 b) 4 c) 0
What is malloc in c++?