![different types of numbers in different languages different types of numbers in different languages](https://cms.groupeditors.com/img/f5825c74-7b95-4344-8aa9-618f113c7b2c.jpg)
In those that do not, quantity must be expressed either directly, with numerals, or indirectly, through optional quantifiers. Not all languages have number as a grammatical category. (In some cases, a normally mass noun X may be used as a count noun to collect several distinct kinds of X into an enumerable group for example, a cheesemaker might speak of goat, sheep, and cow milk as milks.) Many languages distinguish between count nouns and mass nouns. Mass nouns, like "milk", "silverware", and "wisdom", are normally used in only the singular form. Only count nouns can be freely used in the singular and in the plural. However, adjectives are not inflected, and some verb forms do not distinguish between singular and plural ("She/They went", "She/They can go", "She/They had gone", "She/They will go"). This is partly the case in English: every noun is either singular or plural (a few forms, such as " fish" and " cannon", can be either, according to context), and at least some modifiers of nouns-namely the demonstratives, the personal pronouns, the articles, and verbs-are inflected to agree with the number of the nouns to which they refer: "this car" and "these cars" are correct, while "*this cars" or "*these car" are ungrammatical and, therefore, incorrect. Noun modifiers (such as adjectives) and verbs may also have different forms for each number class and be inflected to match the number of the nouns to which they refer (number is an agreement category).
![different types of numbers in different languages different types of numbers in different languages](http://1.bp.blogspot.com/-KktTpIaPUSs/TaCQvuRA6GI/AAAAAAAAAJc/LzBHmN-laSY/w1200-h630-p-k-no-nu/C-gods-programming-language.jpg)
Every noun belongs to a unique number class (nouns are partitioned into disjoint classes by number).In the second sentence, all this information is redundant, since quantity is already indicated by the numeral "two".Ī language has grammatical number when its nouns are subdivided into morphological classes according to the quantity they express, such that: "apples" plural number (more than one item)-on the demonstrative, "that/those", and on the verb, "is/are". The number of apples is marked on the noun-"apple" singular number (one item) vs. As an example, consider the English sentences below: Grammatical number is a morphological category characterized by the expression of quantity through inflection or agreement. Discussion of other more elaborate systems of number appears below. One widespread distinction, found in English and many other languages, involves a simple two-way number contrast between singular and plural ( car/ cars, child/ children, etc.). Variable(String, "Example", Integer, 3, Double, 3.Most languages of the world have formal means to express differences of number. * there is normally no difference between theseįprintf(stderr, "unknown type specifier\n") String, Integer, Double, Float = Double, /* unless you want to store the value in a poitner Parameter " specifiers" could be an enum enumerating all supported types, like this #include So you must be very careful or, use printf() style specifiers and tell the compiler to warn if such mismatch occurs.Īnother solution, is to do it like some of glib's functions, pass a type specifier and immediately after the parameter, with a last value that would indicate the end of the parameters. Of course, any mismatch between the specifiers and the actual types of the arguments will lead to undefined behavior and as a logical consequence to undesired behavior. For variable arguments functions, you need a first parameter that is not part of the variable parameters, use it as a format string to determine the type of parameter x at position n.īecause the first parameter is mandatory, so you MUST have such a parameter and it seems natural to use it as an indicator of what to expect in the variable arguments.įprintf(stdout, "arg: %s\n", count, va_arg(args, const char *)) įprintf(stdout, "arg: %d\n", count, va_arg(args, int)) įprintf(stdout, "arg: %f\n", count, va_arg(args, double)) This is somehow already done, for example printf() has such mechanism.