ArticleDirectory
- C ++ & C
- Standard C/C ++ comparisons
- Cruel comparisons
C ++ & C
- Can you declare a C struct that looks like a C ++ class and somehow call member functions?
- What is the difference betweenParameterAndArgument?
Standard C/C ++ comparisons
- How can you make C code resemble C ++ code? (I. e. Write Object Oriented code with C)
- State some differences between a CStructAnd a C ++Struct.
- Write a snippet of code that will compile in C but not in C ++.
- What is the differenceMallocAndOperator new?
Answer:The difference is really the return value and arguments each take. to begin with malloc is a function whereas new is an C ++ operator. malloc returns a void pointer and it is the responsibility of the user to typecast to the appropriate data type whereas new returns object of type being allocated. malloc takes in number of bytes to be allocated as the parameter which is an integer (or size_t) whereas new takes the type of the ype (can be a class as well ).Bonus:It is generally not a good idea to mix C and C ++ I. e. Use malloc and use delete or use new and use free Item 3: Valid tive C ++
Cruel comparisons
- Are C programmers better than C ++ programmers?
Answer:This is really not an apple to Apple comparision. Let us drop this question right here
- Why are open source operating systems written in C instead of C ++?
Answer:Performance is a factor rather than re usability.
- What makes C more suitable for writing threaded apps than C ++?
Answer:Performance again