HomeQ&AIn computer programming, What does "String" mean?

In computer programming, What does "String" mean?

0
votes

In computer programming, What does "String" mean?

50949 views
updated Sep 2, 2009
edited by 0074b507
posted by Tonche
It's vocabulary, but not quite what I think was intended for this category. - 0074b507, Sep 2, 2009

5 Answers

2
votes

It is a data type. Examples:

  • A bit is either a 0 or a 1
  • A byte is a number between 0 and 255 (if unsigned), equivalent to 8 bits.
  • A word is a number between 0and 65535 (if unsigned), equivalent to 16 bits.
  • A string is a sequence of characters, eg. "Hello, world!".
updated Sep 2, 2009
posted by lazarus1907
1
vote

In C++/C programming

A string is a series of characters treated as a single unit. A string may include letters, digits, and various special characters.

In C, string constants/string literals are written with double quotation marks, such as.

"James Madison" [a name]

"2525 E. Main Street [an address]

"(888) 555-4567 [a telephone number]

It is not uncommon to encounter programs that require the user to enter in this information presented above (Name, address, telephone number, etc). The data typed in by the user is usually stored in the memory as a string.

A string, in the C language, acts as a pointer in that their (memory) address is accessed via a pointer to the first character in the string with the end of the string indicated by a null character.

The value of the string is the address of its first character (analogous to an array as an array is also a pointer to its first element)

Although I only have a passing familiarity with other computer languages, I believe that similar data is handled in an analagous fashion in other computer languages as well (i.e. with the use of strings).

Good luck grin

updated Sep 2, 2009
edited by Izanoni1
posted by Izanoni1
0
votes

Wow, we have a good group of C#s here. I just could not resist that. But really, I never encountered so many brilliant people in so many fields as we have here.

updated Sep 2, 2009
posted by Zoltán
I stopped before C#, but I am still OK with C/C++/Pascal/Basic/Assembler and not too bat at many other ones, like Java, JavaScript, and God knows how many more script languages. - lazarus1907, Sep 2, 2009
Nice pun Zoltán ;-) - Izanoni1, Sep 2, 2009
0
votes

A word is a number between 0and 65535 (if unsigned), equivalent to 16 bits # A string is a sequence of characters, eg. "Hello, world!".

The definition of a "word" depends on the computer's architecture. Most of my professional career was spent working with IBM mainframes for which a word was 4 bytes (32 bits) and a halfword word was 16 bits (what Intel architecture calls a word). There have also been architectures for which a word was (I think) 36 bits. On the whole, the length of a word corresponds to the length/width of the most commonly used register of that architecture.

The definition of a string depends on the (programming) language under discussion. Most languages will accept any sequence of bytes (printable or not). C (and C++) are somewhat peculiar in that they don't really recognize "strings" as language elements at all. There are sub-routines for dealing with strings (in the normal sense) but these are not built into the language (as contrasted with, for example, Pascal).

updated Sep 2, 2009
edited by samdie
posted by samdie
I was probably using a mix of Basic and C in my definitions, but you've gone to far this time, hehe. I didn't know you were a programmer too! - lazarus1907, Sep 2, 2009
0
votes

A set of characters.

updated Sep 2, 2009
posted by jack17
SpanishDict is the world's most popular Spanish-English dictionary, translation, and learning website.
© Curiosity Media Inc.
SOCIAL NETWORKS
APPS