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
Create a simple code fragment that will swap the values of two variables num1 and num2.
How do I round numbers?
number of times a digit is present in a number
largest Of three Number using without if condition?
Which is better oop or procedural?
Why is c called c not d or e?
What is the purpose of the following code? Is there any problem with the code? void send(int count, short *to, short *from) { /* count > 0 assumed */ register n = (count + 7) / 8; switch (count % 8) { case 0: do { *to = *from++; case 7: *to = *from++; case 6: *to = *from++; case 5: *to = *from++; case 4: *to = *from++; case 3: *to = *from++; case 2: *to = *from++; case 1: *to = *from++; } while (--n > 0); } }
Explain how can type-insensitive macros be created?
What is header file in c?
how is the examination pattern?
The difference between printf and fprintf is ?
Study the following C program :call_me (myvar)int myvar;{ myvar +- 5; }main(){int myvar;myvar = 3;call_me(myvar);printf("%d ",myvar);What will be printed a) 3 b) 5 c) 8 d) symbol
what is stack , heap ,code segment,and data segment
Who developed c language and when?
what is the basis for selection of arrays or pointers as data structure in a program