What normal C constructs work differently in C++?

Answers were Sorted based on User's Feedback



What normal C constructs work differently in C++?..

Answer / guest

- Assigning int's to enum's.
- Assigning void pointers to other types of pointers.
- Function declaration foo() without parameters.
- Character constants are of type char in C++. They are of
type int in C.
- ALL functions MUST be prototyped in C++, which is not
required in C.
- In C++:
struct A { /* ... */ };
is equivalent to:
typedef struct A { /* ... */ } A;
in C.

Is This Answer Correct ?    2 Yes 0 No

What normal C constructs work differently in C++?..

Answer / achal ubbott

I just add 2 more points. C++ is a different language. Its
syntax matches to C accidentally.

1. C++ follows a name mangling algorithm for names of
functions. C does not.

2. C++ structures may have functions defined in them. Not
in C.

3. C++ follows more strict type checking.

Is This Answer Correct ?    0 Yes 0 No

Post New Answer

More OOPS Interview Questions

What is the use of unnamed namespaces in OOPS? The only advantage I know is that they dont need the scope resolution operator while accessing them. I want to know some other advantages of unnamed namespaces...

2 Answers  


How many human genes are polymorphic?

0 Answers  


Contrast OOP and SOA. What are tenets of each?

1 Answers   Siebel Systems, Wipro,


What is the main feature of oop?

0 Answers  


Can a destructor be called directly?

0 Answers  






What does and I oop mean?

0 Answers  


What is the full form of oops?

0 Answers  


#include <string.h> #include <stdio.h> #include <stdlib.h> #include <conio.h> void select(char *items, int count); int main(void) { char s[255]; printf("Enter a string:"); gets(s); select(s, strlen(s)); printf("The sorted string is: %s.\n", s); getch(); return 0; } void select(char *items, int count) { register int a, b, c; int exchange; char t; for(a = 0; a < count-1; ++a) { exchange = 0; c = a; t = items[ a ]; for(b = a + 1; b < count; ++b) { if(items[ b ] < t) { c = b; t = items[ b ]; exchange = 1; } } if(exchange) { items[ c ] = items[ a ]; items[ a ] = t; } } } design an algorithm for Selection Sort

0 Answers  


Prepare me a program for the animation of train

0 Answers  


what is oppes

2 Answers  


What are the benefits of interface?

0 Answers  


What is encapsulation in oops?

0 Answers  


Categories