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 is the advantage of an external iterator.
What is an overflow error?
What are formatting flags in ios class?
Explain the advantages of using friend classes.
How is modularity introduced in C++?
Explain what data encapsulation is in c++?
Can a list of string be stored within a two dimensional array?
Why is main function important?
Is multimap sorted c++?
Describe friend function & its advantages.
What sorting algorithm does c++ use?
What is function prototyping? What are its advantages?
Name the debugging methods that are used to solve problems?
Can there be at least some solution to determine the number of arguments passed to a variable argument list function?
In a function declaration, what does extern mean?