answersLogoWhite

0

Is c is the subset of c?

Updated: 8/11/2023
User Avatar

Wiki User

10y ago

Best Answer

No, C is its own language. However, C++ is another language that is based on C, but isn't really a "superset" of it. C++ introduces object-oriented-programming, which facilitates development much more easily than the original C. In fact, there are a whole class of languages based on C, including C# and C++. Note: The (ancient) predecessor of C was B.

User Avatar

Wiki User

13y ago
This answer is:
User Avatar
More answers
User Avatar

Wiki User

9y ago

Strictly speaking, no, C is not a subset of C++. In order for C to be a subset of C++, it must follow that C++ be a superset of C, neither of which is the case. While many people regard C as a subset of C++ and C++ a superset of C, even the Bjarne Stroustrup, the original developer of C++, disagrees. In his own book, 'The C++ Programming Language', Stroustrup writes:

"C++ was developed from the C Programming language and, with few exceptions, retains C as a subset."

"Except for minor details, C++ is a superset of the C programming language."

Were it not for the "few exceptions" and "minor details", C would indeed be a true subset of C++ because every C program would then be regarded as a valid C++ program, which is simply not the case. Although the differences are few, the necessary modifications could be extensive and would be disruptive to existing C compilers. To alleviate the problem and allow compilation under both C and C++ compilers with minimal disruption, pre-compiler directives can be used to inform the C++ compiler that the enclosed code should be compiled separately using a C compiler rather than the C++ compiler (C compilers simply ignore C++ directives). Although some compilers can detect C code and compile accordingly, it is not part of the C++ specification and therefore cannot be relied upon for portability purposes.

This answer is:
User Avatar

User Avatar

Wiki User

10y ago

No. C is just C. C++ is a superset of C.

This answer is:
User Avatar

Add your answer:

Earn +20 pts
Q: Is c is the subset of c?
Write your answer...
Submit
Still have questions?
magnify glass
imp
Continue Learning about Engineering

What is code of finding all subset in a set in c?

Each element of C can either be in a particular subset or not in it - two options for each element of C. So if there are n elements in C, then the number of subsets of C is 2n. These include the null set and C itself.


How do you write c programme to find proper subset of a given string?

you can use strstr()


What does a char store?

In JavaA char in Java is a 16-bit integer, which maps to a subset of Unicode.In C A char in C is an 8-bit integer, which maps to standard ASCII.Note that in both Java and in C you can use a char value like a normal integer type: char c = 48;


Is every subset of a finite set is a finite?

prove that every subset of a finite set is a finite set?


How do you enumerate all the possible subsets of x y z in C plus plus?

Enumerating subsets requires that each element in the set be mapped to a bit value. Combining these bit values (with logical OR) gives you the subset. Each subset will then have a value in the range 0 to 7, giving 8 subsets in all: {}, {x}, {y}, {z}, {x, y}, {x, z}, {y, z}, {x, y, z}. However, you cannot simply count from 0 to 7 to enumerate these subsets because this is highly inefficient. In a set of 3 it's not a significant loss, but in a larger set the inefficiency is substantial. For instance, in a set of just 64 elements, you must count from 0 to 9,223,372,036,854,775,809 in order to enumerate the 64 subsets that have just one element. If that doesn't drive the point home, then nothing will.In order to correctly enumerate subsets you must use the Banker's sequence. Each sequence varies depending upon how many elements are in the set, however the sequence allows you to quickly enumerate one set after another in a logical sequence. It also allows you to start from anywhere in the sequence and continue from that point on, thus making it possible to quickly enumerate all sets with a specific number of elements.The following code is quite involved but includes several auxiliary functions that help speed up the main code at the bottom. Some examples are included to demonstrate different usages, including the enumeration of subsets of {x, y, z}, subsets of a set of 5 elements and subsets of a subset of a 9 element set. Note that the final example (all subsets of a 32 element set) is commented out because it will take a seriously long time to enumerate all the possible subsets. However, the code is flexible enough to allow you to narrow the search down to just those subsets with a specific number of elements.Note that the two main functions to focus upon are the find_first_subset() and find_next_subset() functions. These two functions are the driving force behind the Banker's sequence.#include // Returns the count of set bits in the given subset.// E.g., 01010010 returns 3.unsigned int count_set_bits( register unsigned int subset ){// An alternative method is to logical AND the bitset with 0x1// then right shift the bitset by 1 bit. That requires an average// of 32 separate operations (worst case is 64). This method always// uses 17, thus always returns in constant time. For unsigned// short, eliminate the last shift. For char, eliminate the last// two shifts.subset -= (( subset >> 1 ) & 0x55555555 );subset = ((( subset >> 2 ) & 0x33333333 ) + ( subset & 0x33333333 ));subset = ((( subset >> 4 ) + subset ) & 0x0f0f0f0f );subset += ( subset >> 8 );subset += ( subset >> 16 );return( subset & 0x0000003f );}// Returns all set bits from the given subset's MSB down.// E.g., 00100010 returns 00111111.// The inversion of the return value can be used to mask// bits that are greater than the MSB in another subset.unsigned int fill_down( register unsigned int subset ){subset |= ( subset >> 1 );subset |= ( subset >> 2 );subset |= ( subset >> 4 );subset |= ( subset >> 8 );subset |= ( subset >> 16 );return( subset );}// Returns the least-significant set bit in the given subset.// E.g., 00100110 returns 00000010.unsigned int get_LSB( register unsigned int subset ){return( subset ^ ( subset & ( subset - 1 )));}// Returns the most-significant set bit in the given subset.// E.g., 00100110 returns 00100000.unsigned int get_MSB( register unsigned int subset ){subset = fill_down( subset );return( subset & ~( subset >> 1 ));}// Returns the first subset of subset_count within the given set.// The return value can be passed to get_next_subset().unsigned int get_first_subset( const unsigned set, unsigned int subset_count ){// Initialise the subset.unsigned int subset = 0;// Check validity of parameters.if( subset_count && subset_count

Related questions

What is the symbol of the subset?

c


What is a subset of records?

a subset is a group that is contained within the other group. So the set of letters {a, b} is a subset of {a, b, c} It is also worth noting that {a, b} is also a subset of itself {a, b}. In set arithmatic a subset I believe is defined like this: set1 is a subset of set2 if set1 + set2 = set2. {a, b} + {a, b, c} = {a, b, c}


What is a proper subsets?

Proper subset definitionA proper subset of a set A is a subset of A that is not equal to A. In other words, if B is a proper subset of A, then all elements of B are in Abut A contains at least one element that is not in B.For example, if A={1,3,5} then B={1,5} is a proper subset of A. The set C={1,3,5} is a subset of A, but it is not a proper subset of A since C=A. The set D={1,4} is not even a subset of A, since 4 is not an element of A.


What is an example of a proper subset?

Let A be the set {1,2,3,4} B is {1,2} and B is a proper subset of A C is {1} and C is also a proper subset of A. B and C are proper subsets of the set A because they are strictly contained in A. necessarily excludes at least one member of A. The set A is NOT a proper subset of itself.


What is code of finding all subset in a set in c?

Each element of C can either be in a particular subset or not in it - two options for each element of C. So if there are n elements in C, then the number of subsets of C is 2n. These include the null set and C itself.


B is a proper subset of C If the cardinal number of C is 8 what is the maximum number of elements in B?

If every element of B is contained in C, then B is a subset of C. If every element of B is contained in C and B is not the same as C, then B is a proper subset of C.The cardinal number of a set is the number of elements in the set.In this case, C has 8 elements, so B has at most 7 elements.


What is the diameter of a subset?

The diameter of the subset C of the metric space B, D is the least upper bound of {D(x, y) | x, y Є C} and is often written as d(C).See related links for more information.


How do you write c programme to find proper subset of a given string?

you can use strstr()


What is the difference between a subset and a proper subset?

the difference between a subset and a proper subset


What are the ASCII codes for subset and proper subset?

Since ASCII ⊊ unicode, I don't know if there are ASCII codes for subset and proper subset. There are Unicode characters for subset and proper subset though: Subset: ⊂, ⊂, ⊂ Subset (or equal): ⊆, ⊆, ⊆ Proper subset: ⊊, ⊊,


How cardinality relates to the number of subsets of a set?

Cardinality is simply the number of elements of a given set. You can use the cardinality of a set to determine which elements will go into the subset. Every element in the subset must come from the cardinality of the original set. For example, a set may contain {a,b,c,d} which makes the cardinality 4. You can choose any of those elements to form a subset. Examples of subsets may be {a,c} {a, b, c} etc.


Why can a proper subset be a subset of itself?

Because every set is a subset of itself. A proper subset cannot, however, be a proper subset of itself.