answersLogoWhite

0

What is type compatibility in c?

Updated: 8/11/2023
User Avatar

Wiki User

9y ago

Best Answer

Compatible data types are data types that are intrinsically the same. For instance,

typedef int myint;

myint x = 0x7fffffff;

int y = x; // x and y are the same type, so assignment is permitted.

int * p = &x; // compatible, p points to x.

*p = y; // compatible, but y is a value, not a memory address.

short z = x; // compatible, but z will be truncated to -1.

z is -1 because x appears in memory in reverse order: 0xffffff7f. Since z is only two bytes in length it is equal to 0xffff after assignment, which equates to -1.

User Avatar

Wiki User

11y ago
This answer is:
User Avatar

Add your answer:

Earn +20 pts
Q: What is type compatibility in c?
Write your answer...
Submit
Still have questions?
magnify glass
imp
Continue Learning about Engineering

Major advantage in cpp compared to c?

The major advantage of C++ over C is the Object Oriented Programming compatibility in C++.


In my system C language does not support for fullscreen mode why?

Your question has nothing to do with C language, it's about your Windows' DOS-compatibility (or incompatibility).


Disadvantages of c plus plus over c?

There are no disadvantages as such since everything you can do in C you can also do in C++, with relatively minor alterations to conform with C++'s stricter type safety. C++ essentially inherits all that is good about C, and attempts to fix all that is bad without overly compromising backward compatibility, as well as adding object-oriented programming support, which constitutes the major difference between C and C++.


Why c plus plus called as paritial oop?

C++ is only partially OOP because it is a superset of C and, for the sake of backward compatibility, retains the concept of primitive data types (such as integrals like char and int) and pointer data types, which are all strictly non-object-oriented. In Java and C#, there is no concept of a primitive data type. Even integral types such as int are treated as objects and there is no concept of a pointer data type.


What is the difference between structure and structure using typedef with example?

Consider the following structure:struct data_t { /* ... */ };The name of this type is struct data_t. This means that we must include the struct keyword whenever we declare any instances of the type or declare a pointer to the type:struct data_t object;struct data_t* ptr;To remove the verbosity of the otherwise redundant structkeyword, we can use an alias:typedef struct data_t data;data object;data* ptr;To simplify things further, we can combine the alias with the structure's definition:typedef struct data_t { /* ... */ } data;Note that the _t suffix is conventionally used to denote a user-defined type as opposed to an alias. However, its usage is not consistent. For instance, the wchar_t type is not a type, it is implemented as an alias in the C standard library header:typedef unsigned short wchar_t;In C++, the typedef keyword is not required; it is retained purely for backward compatibility with C. Aliases are introduced with the using keyword, never with typedef. We only use typedef when we are explicitly writing code intended for compilation under both C and C++.Note also that wchar_t (amongst others) is a built-in type in C++, so we don't need to include the C standard library to make use of it, unless we are writing code for C.

Related questions

What is the most common type of compatibility that a software manufacturer will provide for new versions of their software?

backward compatibility but not forward compatibility


What should you do to ensure that your website is accessible to the widest audience?

c. consider device compatibility and assistive technology.page 428 c. consider device compatibility and assistive technology.


Major advantage in cpp compared to c?

The major advantage of C++ over C is the Object Oriented Programming compatibility in C++.


In my system C language does not support for fullscreen mode why?

Your question has nothing to do with C language, it's about your Windows' DOS-compatibility (or incompatibility).


What determines compatibility between a motherboard and a video card?

The Slot Type


Why c plus plus is partially object oriented?

To allow backward compatibility and interoperability with ANSI C, which is entirely non-object-oriented.


Disadvantages of c plus plus over c?

There are no disadvantages as such since everything you can do in C you can also do in C++, with relatively minor alterations to conform with C++'s stricter type safety. C++ essentially inherits all that is good about C, and attempts to fix all that is bad without overly compromising backward compatibility, as well as adding object-oriented programming support, which constitutes the major difference between C and C++.


What has the author J C Toler written?

J. C. Toler has written: 'Electromagnetic compatibility program plan' -- subject(s): Radio, Interference


Why c plus plus called as paritial oop?

C++ is only partially OOP because it is a superset of C and, for the sake of backward compatibility, retains the concept of primitive data types (such as integrals like char and int) and pointer data types, which are all strictly non-object-oriented. In Java and C#, there is no concept of a primitive data type. Even integral types such as int are treated as objects and there is no concept of a pointer data type.


Which type of user group provides backwards compatibility with windows XP?

power users group


Is there a program compatibility wizard in Windows 7?

To run Windows Compatibility Troubleshooter wizard, type in Action Center in Start menu search box and hit enter. Then in the left pane of the Action Center, click on the link labeled Windows Compatibility Troubleshooter to start the troubleshooting wizard.


Can blood type AA marry AA?

Yes, individuals with blood type AA can marry each other. Blood type compatibility does not impact the ability for individuals to marry. However, if the individuals plan to have children, it is recommended to consult with a healthcare professional to understand any potential blood type compatibility issues that may arise for the offspring.