0

I have learned English most on programmers forums, so please excuse me for a potentially stupid question.

char - primitive data-type that store letter or other UTF-symbol
Character - object data-type that store letter or other UTF-symbol.

What is the word "char", word of English language or abbreviation used only in programming languages?

Is it correct to use something like "Text length: x chars", or better "Text length: x characters"?

3

"Char" was originally simply short for "character", but came to mean a data type for a variable intended to hold character data. I have not seen it used outside of a technical programming / computer science context.

"Text length: x chars" would be perfectly well understood in a technical programming or data processing context. If people other than technically oriented computer specialists of some sort are the audience, then "Text length: x characters" would probably be clearer and better. Even for a technical audience, the longer form will be understood perfectly well, and may actually be clearer if dealing with international unicode characters which require multiple bytes of data. (Note that Unicode can be stored in other forms than UTF.)

When referring to the actual data type in a technical context, "CHAR" should be preferred to "character". In SQL "CHAR" is the name for a datatype storing one or multiple characters, and NCHAR for the datatype storing unicode international characters, for example. Other languages may have slightly different usage.

  • Thanks, for non-programmers word "character" more understandable so better to use it, and yes, Unicode can be not UTF, but as I know UTF is most popular encoding for now (and perfect for my needs) – Bogdan Samchuk Apr 12 at 20:23
1

In IT jargon, "char" is a keyword or data type used in some programming languages to store a single character, and also can be an abbreviation of "character", just like "dir" can be an abbreviation of "directory", and "TB" can be an abbreviation of "terabyte". In general, for informal messages about topics, IT related or not, you can use abbreviations or contractions, that understood by you and your audience, but for formal or academic work, write them in full.

0

In most implementations of C, a char is 8 bits long, and so not long enough for most UTF symbols. In C, a char is an arithmetic type, so comes in signed and unsigned variants.

In other computer languages, a char may refer to something else. However char is not a word of general English, though could be understood in a technical discussion with computer programmers. "Text length 10 chars" would imply exactly ten 8-bit-bytes—Certainly including spaces and perhaps also including the "null" byte that C uses at the end of strings. UTF strings require more than one "char" to represent a character.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.