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 |
What is the Standard Template Library?
What is flush c++?
What is public, protected, private in c++?
Explain the virtual inheritance in c++.
Describe the advantage of an external iterator.
Describe Trees using C++ with an example.
What is Destructor in C++?
write a programme to get a character and thier ASCII value
Is arr and &arr are same expression for an array?
If there are 1 to 100 Numbers in array of 101 elements. Which is the easy way to find repeated number?
What is the most useful programming language?
How do you initialize a class member, class x { const int i; };