what is available in C language but not in C++?
Answer Posted / preeti singh
C allows a void* pointer to be assigned to any pointer type
without a cast, whereas C++ does not.
void* ptr;
int *i = ptr;
int *j = malloc(sizeof(int) * 5);
this is valid in C but not in C++.
In C++ explicit cast needs to be applied as given below.
void* ptr;
int *i = (int *) ptr;
int *j = (int *) malloc(sizeof(int) * 5);
| Is This Answer Correct ? | 13 Yes | 1 No |
Post New Answer View All Answers
What is #error and use of it?
How are 16- and 32-bit numbers stored?
What would be an example of a structure analogous to structure c?
p*=(++q)++*--p when p=q=1 while(q<=6)
What is a union?
Explain why c is faster than c++?
What is bubble sort in c?
Does free set pointer to null?
What does sizeof return c?
c program to compute AREA under integral
Is there anything like an ifdef for typedefs?
What the advantages of using Unions?
Design a program which assigns values to the array temperature. The program should then display the array with appropriate column and row headings.
Why is main function so important?
An organised method of depicting the use of an area of computer memory used to signify the uses for different parts of the memory a) swap b) extended memory c) memory map d) all of the above