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 the difference between break and continue?
What oops means?
How can I discover how many arguments a function was actually called with?
What do you understand by friend-functions? How are they used?
Simplify the program segment if X = B then C ← true else C ← false
Is c++ based on c?
What are the benefits of organizational structure?
What are types of structure?
What is a class c rental property?
What is masking?
Can you please compare array with pointer?
Why c is called free form language?
What is the size of enum in c?
5 Write an Algorithm to find the maximum and minimum items in a set of ānā element.
How do you define a string?