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
How the delete operator differs from the delete[]operator?
What is c++ virtual inheritance?
Explain one-definition rule (odr).
Is c++ the best programming language?
Can we run c program in turbo c++?
What is an accessor in c++?
What is namespace & why it is used in c++?
Which coding certification is best?
What is a container class? What are the types of container classes in c++?
What is time h in c++?
What do you understand by pure virtual function? Write about its use?
Are strings immutable in c++?
Is the declaration of a class its interface or its implementation?
write a program that withdrawals,deposits,balance check,shows mini statement. (using functions,pointers and arrays)
How would you obtain segment and offset addresses from a far address of a memory location?