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 significance of an algorithm to C programming?
What are the benefits of c language?
What is the difference between specifying a constant variable like with constant keyword and #define it? i.e what is the difference between CONSTANT FLOAT A=1.25 and #define A 1.25
Write a program to find factorial of a number using recursive function.
Why malloc is faster than calloc?
which of the following is not a character constant a) 'thank you' b) 'enter values of p, n ,r' c) '23.56E-o3' d) all of the above
How do we open a binary file in Read/Write mode in C?
Is calloc better than malloc?
What is the c value paradox and how is it explained?
What is volatile variable how do you declare it?
Given a valid 24 hour format time find the combination of the value and write a program ,do not hard the value and if any other inputs provided should work with the logic implemented Input: 11:30 Output: 13:10 Input: 18:25 Output: 21:58
What is the difference between malloc() and calloc()?
What is an lvalue?
What are external variables in c?
How the c program is executed?