Is C fully C compatible, and is C fully C compatible?

Updated on technology 2024-04-06
19 answers
  1. Anonymous users2024-02-07

    C++ is compatible with most C programming languages.

    C++ is an object-oriented programming language developed on the basis of C language, which is widely used. C++ supports a variety of programming paradigms: object-oriented programming, generic programming, and procedural programming.

    C is the foundation of C++, and C++ and C are compatible in many ways.

    C++ is generally considered to be a superset of C, but this is not rigorous. Most C**s can be easily compiled correctly in C++, but there are still a few differences that cause some valid C**s to fail in C++, or behave differently in C++.

    One of the most common differences is that C allows implicit conversion from void* to other pointer types, but C++ does not.

    For example, int*i=malloc(sizeof(int)*5);

    What is legal in C is required in C++.

    int*i=(int*)malloc(sizeof(int)*5);

    Another common portable problem is that C++ defines new keywords, such as new, class, which can be used as identifiers in C programs.

  2. Anonymous users2024-02-06

    Yes. C can be seen as part of C++.

  3. Anonymous users2024-02-05

    C++ is compatible with most C programming languages.

    C++ is an object-oriented programming language developed on the basis of C language, which is widely used. C++ supports a variety of programming paradigms: object-oriented programming, generic programming, and procedural programming.

    C is the foundation of C++, and C++ and C are compatible in many ways.

    C++ is generally considered to be a superset of C, but this is not rigorous. Most C**s can be easily compiled correctly in C++, but there are still a few differences that cause some valid C**s to fail in C++, or behave differently in C++.

    One of the most common differences is that C allows implicit conversion from void* to other pointer types, but C++ does not.

    For example, int*i=malloc(sizeof(int)*5);

    What is legal in C is required in C++.

    int*i=(int*)malloc(sizeof(int)*5);

    Another common portable problem is that C++ defines new keywords, such as new, class, which can be used as identifiers (e.g., variable names) in C programs.

  4. Anonymous users2024-02-04

    C++ is a superset of C, and C is a subset of C++. Generally speaking, if you learn C++, you will definitely be able to understand the C program.

    But because nowadays, C++ is generally developed for upper-level applications, such as VC++, Qt, etc.

    And C is generally biased towards the bottom, using a compiler such as gcc to compile it, so although you can understand it, you may not be able to understand it, or you can develop it (which is why many pure C are treated quite high).

    Language is actually very simple, and what really matters is a lot of other technologies, so keep a learning mentality, it doesn't matter which language you learn.

  5. Anonymous users2024-02-03

    You can't write ** exactly in the way of c, so some of them won't work.

    C's memory model is not the same as C++'s!

    C++ has a unified standard, and compiler developers such as Brown and Microsoft develop compilers on top of it, but they are not 100% compatible.

    There are also international standards and compilers developed by different developers.

    Generally speaking, C++ is compatible with C, however, due to historical reasons, the transformation of data structures and the huge library left behind, no one dares to say that C++ is fully compatible with C

  6. Anonymous users2024-02-02

    C is included in C++, and under certain program conditions, the two can be converted to each other, but beyond this certain condition, it will definitely not work. This part is definitely related to the new features of C++.

  7. Anonymous users2024-02-01

    Strictly from a grammatical point of view, there are some small incompatibilities. However, it can be overcome, for example, C++'s type is stricter, void * needs to cast cast, and C's void* can point to any pointer type without casting.

    C++ does not need to write struct for reference struct types.

    In practice, the compiler product and version need to be as consistent as possible. Just don't use VC for part and GCC for some compilation.

    With a C++ compiler, it is possible to write C++** compatible C, or to link C++ programs to C libraries. This is also commonly done.

    It should be noted that the compiler setter for referencing C** in C++ is different, and extern needs to be added to the reference"c"

  8. Anonymous users2024-01-31

    They are only syntactically similar, not intrinsically related, and not fully compatible.

    The syntax of C and C++ is similar, but the differences are quite large

    2 The same keyword interpretation is not necessarily the same. For example, struct interpretation is different. In C++, structs are actually explained in terms of classes (i.e., classes), which can have member functions, member variables, constructors, destructors, and so on.

    The struct in C is a data structure, and there is no such thing as a member function or constructor.

    3 C++ has more advanced syntax features such as namespaces, templates, etc., which the C language does not have.

    4 The compiler used is also different. In Linux, C++ uses the G++ compiler, while C uses the GCC compiler. If you pass C++ to the GCC compiler, it will call G++ to compile.

    If you compile C in G++, it will be interpreted in the same way as C++, so that some structs may behave differently than you expect.

    5 They use different ranges. C++ is generally for application-level program development, while C is for kernel or driver-level development. C is generally not used for application development these days.

    6 The libraries used are also different. C++ can use C libraries, but C may not be able to use C++ libraries, unless the C++ library interface is written according to the C specification.

    The 7 C language is a procedural development language with functions and data structures at its core. C++ is an object-oriented development language with classes and reuse at its core.

    In short, they are not the same, and they should not be confused. You can learn C++ directly and skip C, which is good for you to understand the ideas of C++. You can also learn C on its own, instead of C++, if you only need to do the kernel or do the driver.

    Don't assume that some basic keywords and grammatical features are similar because they're compatible.

  9. Anonymous users2024-01-30

    Theoretically, yes, but the reality is not limited to developing the language itself. Application-specific knowledge is required.

  10. Anonymous users2024-01-29

    C++ is developed on the basis of C, so C is the foundation of C++ and it is not recommended to skip it.

    But if you want to jump, just jump, and customer service will do it if there is a problem.

  11. Anonymous users2024-01-28

    。。。Most C++ compilers can compile C programs... As long as you contain.

  12. Anonymous users2024-01-27

    OK. There are no major drawbacks, but if you start with C++, you can avoid the C-like structured programming mindset and go straight to object-oriented.

    But let me remind you that object-orientation is harder than structured programming.........It's much easier to use C++ as C than to write an object-oriented program in C++.

  13. Anonymous users2024-01-26

    There are no drawbacks, but it will be faster to learn C and learn C++ first, and it will be better to understand.

  14. Anonymous users2024-01-25

    C++ is a superset of the C language, it doesn't matter, of course, if you know C, it will be helpful for learning C++, but not absolutely.

  15. Anonymous users2024-01-24

    Suffice it to say, for example, the input and output of C are all possible in C++.

  16. Anonymous users2024-01-23

    C++ is object-oriented programming and is flexible.

  17. Anonymous users2024-01-22

    It is recommended to learn C first, which is the foundation of all programming languages.

  18. Anonymous users2024-01-21

    Compatible, no drawbacks, the same.

  19. Anonymous users2024-01-20

    Type-compatible rules mean that objects of a public derived class can be used as an alternative wherever a base class object is required. Through public inheritance, the derived class gets all the members of the base class except for the constructor and destructor. In this way, the publicly-owned derived class actually has all the functions of the base class, and any problem that the base class can solve, the public-derived class can solve.

    Substitutions referred to in the Type Compatibility Rule include the following:

    1. The object of the derived class can be assigned to the object of the base class;

    2. The object of the derived class can initialize the reference of the base class;

    3. The address of the derived class object can be assigned a pointer to the base class.

    After the substitution, the derived class object can be used as an object of the base class, but only members inherited from the base class can be used.

    Type-compatible rules are one of the important foundations of polymorphism.

Related questions
11 answers2024-04-06

In the BIOS, first block the sound card integrated on the motherboard, and use the driver of the sound card first for correct installation. >>>More

18 answers2024-04-06

C will not be outdated, just like the compilation, although it is not as popular as C++ C now, but if you can master this thing, it is definitely a hot item, and it is a ** hot item.

23 answers2024-04-06

It shouldn't be, it's just compatible, it's for the sake of users.

7 answers2024-04-06

Chemotherapy drugs are very hot, very toxic, chemotherapy is a wrong method, resulting in qi and blood deficiency, impaired spleen and stomach function, nausea and vomiting, hair loss, damage to qi and blood, hair can not be fed and definitely lost, constipation, but also qi and blood damage and less water, people are very painful, you can see that many people are treated to the end, the doctor is going to drive you home, you can't give chemotherapy, the body has been damaged, go home and wait for death. >>>More

13 answers2024-04-06

Essential tremor cannot be controlled, but can only be controlled. Patients with essential tremor can be treated with drugs**, such as propranol, sulephamam, clonidazepam and other drugs, but they can only control the symptoms, that is, reduce tremor and improve the quality of life, but it cannot reach the level of ** at present. And it is obvious that 60% of patients basically have a family history, that is, hereditary, and genetic diseases caused by genes are currently clearly unable to **. >>>More