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 |
When do we run a shell in the unix system?
What is c++ in english?
Why do we use the using declaration?
Mention the storage classes in c++.
Carry out conversion of one object of user-defined type to another?
Can a constructor be private?
What is a block in c++?
What is null pointer and void pointer?
What is a node class?
Is c++ low level?
Explain static and dynamic memory allocation with an example each.
Declare a class vehicle and make it an abstract data type.