World Library  
Flag as Inappropriate
Email this Article

Character literal

Article Id: WHEBN0041467632
Reproduction Date:

Title: Character literal  
Author: World Heritage Encyclopedia
Language: English
Subject: Character encoding, Data types, Escape sequence, Character (computing), String literal
Collection: Character Encoding, Data Types
Publisher: World Heritage Encyclopedia
Publication
Date:
 

Character literal

A character literal is the representation of a character value within the source code of a computer program. Languages that have a character data type generally have character literals; these include C, C++, Java, and Visual Basic, but not Python. A common convention is to use a single quote (') for character literals and a double quote (") for string literals. For example, 'a' indicates the single character a while "a" indicates the string a of length 1.

Alternative ways to encode literal character values include specifying an integer value for a code point. This may be done directly via converting an integer literal to a character, or via an escape sequence. Character literals are generally syntactically similar to single-character string literals.

See also


This article was sourced from Creative Commons Attribution-ShareAlike License; additional terms may apply. World Heritage Encyclopedia content is assembled from numerous content providers, Open Access Publishing, and in compliance with The Fair Access to Science and Technology Research Act (FASTR), Wikimedia Foundation, Inc., Public Library of Science, The Encyclopedia of Life, Open Book Publishers (OBP), PubMed, U.S. National Library of Medicine, National Center for Biotechnology Information, U.S. National Library of Medicine, National Institutes of Health (NIH), U.S. Department of Health & Human Services, and USA.gov, which sources content from all federal, state, local, tribal, and territorial government publication portals (.gov, .mil, .edu). Funding for USA.gov and content contributors is made possible from the U.S. Congress, E-Government Act of 2002.
 
Crowd sourced content that is contributed to World Heritage Encyclopedia is peer reviewed and edited by our editorial staff to ensure quality scholarly research articles.
 
By using this site, you agree to the Terms of Use and Privacy Policy. World Heritage Encyclopedia™ is a registered trademark of the World Public Library Association, a non-profit organization.
 


Copyright © World Library Foundation. All rights reserved. eBooks from Project Gutenberg are sponsored by the World Library Foundation,
a 501c(4) Member's Support Non-Profit Organization, and is NOT affiliated with any governmental agency or department.