C# check if item is in list

Welcome to the learn-c.org free interactive C tutorial.

Whether you are an experienced programmer or not, this website is intended for everyone who wishes to learn the C programming language.

There is no need to download anything - Just click on the chapter you wish to begin from, and follow the instructions. Good luck!

learn-c.org is still under construction - If you wish to contribute tutorials, please click on Contributing Tutorials down below.

Learn the Basics

Advanced

Contributing Tutorials

Read more here: Contributing Tutorials

C is a computer programming language. That means that you can use C to create lists of instructions for a computer to follow. C is one of thousands of programming languages currently in use. C has been around for several decades and has won widespread acceptance because it gives programmers maximum control and efficiency. C is an easy language to learn. It is a bit more cryptic in its style than some other languages, but you get beyond that fairly quickly.

C is what is called a compiled language. This means that once you write your C program, you must run it through a C compiler to turn your program into an executable that the computer can run (execute). The C program is the human-readable form, while the executable that comes out of the compiler is the machine-readable and executable form. What this means is that to write and run a C program, you must have access to a C compiler. If you are using a UNIX machine (for example, if you are writing CGI scripts in C on your host's UNIX computer, or if you are a student working on a lab's UNIX machine), the C compiler is available for free. It is called either "cc" or "gcc" and is available on the command line. If you are a student, then the school will likely provide you with a compiler -- find out what the school is using and learn about it. If you are working at home on a Windows machine, you are going to need to download a free C compiler or purchase a commercial compiler. A widely used commercial compiler is Microsoft's Visual C++ environment (it compiles both C and C++ programs). Unfortunately, this program costs several hundred dollars. If you do not have hundreds of dollars to spend on a commercial compiler, then you can use one of the free compilers available on the Web. See http://delorie.com/djgpp/ as a starting point in your search.

We will start at the beginning with an extremely simple C program and build up from there. I will assume that you are using the UNIX command line and gcc as your environment for these examples; if you are not, all of the code will still work fine -- you will simply need to understand and use whatever compiler you have available.

Let's get started!

C# check if item is in list

C programming is a general-purpose, procedural, imperative computer programming language developed in 1972 by Dennis M. Ritchie at the Bell Telephone Laboratories to develop the UNIX operating system. C is the most widely used computer language. It keeps fluctuating at number one scale of popularity along with Java programming language, which is also equally popular and most widely used among modern software programmers.

Why to Learn C Programming?

C programming language is a MUST for students and working professionals to become a great Software Engineer specially when they are working in Software Development Domain. I will list down some of the key advantages of learning C Programming:

  • Easy to learn

  • Structured language

  • It produces efficient programs

  • It can handle low-level activities

  • It can be compiled on a variety of computer platforms

Facts about C

  • C was invented to write an operating system called UNIX.

  • C is a successor of B language which was introduced around the early 1970s.

  • The language was formalized in 1988 by the American National Standard Institute (ANSI).

  • The UNIX OS was totally written in C.

  • Today C is the most widely used and popular System Programming Language.

  • Most of the state-of-the-art software have been implemented using C.

Just to give you a little excitement about C programming, I'm going to give you a small conventional C Programming Hello World program, You can try it using Demo link.

#include <stdio.h> int main() { /* my first program in C */ printf("Hello, World! \n"); return 0; }

Applications of C Programming

C was initially used for system development work, particularly the programs that make-up the operating system. C was adopted as a system development language because it produces code that runs nearly as fast as the code written in assembly language. Some examples of the use of C are -

  • Operating Systems

  • Language Compilers

  • Assemblers

  • Text Editors

  • Print Spoolers

  • Network Drivers

  • Modern Programs

  • Databases

  • Language Interpreters

  • Utilities

Audience

This tutorial is designed for software programmers with a need to understand the C programming language starting from scratch. This C tutorial will give you enough understanding on C programming language from where you can take yourself to higher level of expertise.

Prerequisites

Before proceeding with this tutorial, you should have a basic understanding of Computer Programming terminologies. A basic understanding of any of the programming languages will help you in understanding the C programming concepts and move fast on the learning track.

Our Try it Yourself tool makes it easy to learn C. You can edit code and view the result in your browser:

Click on the "Try it Yourself" button to see how it works.

We recommend reading this tutorial, in the sequence listed in the left menu.

C Exercises

Learn by taking a quiz! The quiz will give you a signal of how much you know about C.

Start C Quiz

Learn by Examples

Learn by examples! This tutorial supplements all explanations with clarifying examples.

See All C Examples



C, or c, is the third letter in the English and ISO basic Latin alphabets. Its name in English is cee (pronounced /ˈs/), plural cees.[1]

C# check if item is in list
CC c(See below)UsageWriting systemLatin scriptTypeAlphabeticLanguage of originLatin languagePhonetic usage

  • [c]
  • [k]
  • [t͡ʃ]
  • [t͡s(ʰ)]
  • [d͡ʒ]
  • [ʃ]
  • []
  • [ʕ]
  • [ʔ]
  • [θ]
  • Others

Unicode codepointU+0043, U+0063Alphabetical position3
Numerical value: 100HistoryDevelopment

C# check if item is in list
  • C# check if item is in list
    • C# check if item is in list
      • C# check if item is in list
        • C# check if item is in list
          • C# check if item is in list
            • Γ γ
              • 𐌂
                • C c

Variations(See below)OtherAssociated numbers100This article contains phonetic transcriptions in the International Phonetic Alphabet (IPA). For an introductory guide on IPA symbols, see Help:IPA. For the distinction between [ ], / / and ⟨ ⟩, see IPA § Brackets and transcription delimiters.

C# check if item is in list

C in copyright symbol

Egyptian Phoenician
gaml
Greek
Gamma
Etruscan
C
Old Latin
C (G)
Latin
C

C# check if item is in list

         

"C" comes from the same letter as "G". The Semites named it gimel. The sign is possibly adapted from an Egyptian hieroglyph for a staff sling, which may have been the meaning of the name gimel. Another possibility is that it depicted a camel, the Semitic name for which was gamal. Barry B. Powell, a specialist in the history of writing, states "It is hard to imagine how gimel = "camel" can be derived from the picture of a camel (it may show his hump, or his head and neck!)".[2]

In the Etruscan language, plosive consonants had no contrastive voicing, so the Greek 'Γ' (Gamma) was adopted into the Etruscan alphabet to represent /k/. Already in the Western Greek alphabet, Gamma first took a ' ' form in Early Etruscan, then ' ' in Classical Etruscan. In Latin it eventually took the 'c' form in Classical Latin. In the earliest Latin inscriptions, the letters 'c k q' were used to represent the sounds /k/ and /ɡ/ (which were not differentiated in writing). Of these, 'q' was used to represent /k/ or /ɡ/ before a rounded vowel, 'k' before 'a', and 'c' elsewhere.[3] During the 3rd century BC, a modified character was introduced for /ɡ/, and 'c' itself was retained for /k/. The use of 'c' (and its variant 'g') replaced most usages of 'k' and 'q'. Hence, in the classical period and after, 'g' was treated as the equivalent of Greek gamma, and 'c' as the equivalent of kappa; this shows in the romanization of Greek words, as in 'ΚΑΔΜΟΣ', 'ΚΥΡΟΣ', and 'ΦΩΚΙΣ' came into Latin as 'cadmvs', 'cyrvs' and 'phocis', respectively.

Other alphabets have letters homoglyphic to 'c' but not analogous in use and derivation, like the Cyrillic letter Es (С, с) which derives from the lunate sigma, named due to its resemblance to the crescent moon.

When the Roman alphabet was introduced into Britain, ⟨c⟩ represented only /k/, and this value of the letter has been retained in loanwords to all the insular Celtic languages: in Welsh,[4] Irish, Gaelic, ⟨c⟩ represents only /k/. The Old English Latin-based writing system was learned from the Celts, apparently of Ireland; hence ⟨c⟩ in Old English also originally represented /k/; the Modern English words kin, break, broken, thick, and seek all come from Old English words written with ⟨c⟩: cyn, brecan, brocen, þicc, and séoc. However, during the course of the Old English period, /k/ before front vowels (/e/ and /i/) were palatalized, having changed by the tenth century to [tʃ], though ⟨c⟩ was still used, as in cir(i)ce, wrecc(e)a. On the continent, meanwhile, a similar phonetic change had also been going on (for example, in Italian).

In Vulgar Latin, /k/ became palatalized to [tʃ] in Italy and Dalmatia; in France and the Iberian peninsula, it became [ts]. Yet for these new sounds ⟨c⟩ was still used before the letters ⟨e⟩ and ⟨i⟩. The letter thus represented two distinct values. Subsequently, the Latin phoneme /kw/ (spelled ⟨qv⟩) de-labialized to /k/ meaning that the various Romance languages had /k/ before front vowels. In addition, Norman used the letter ⟨k⟩ so that the sound /k/ could be represented by either ⟨k⟩ or ⟨c⟩, the latter of which could represent either /k/ or /ts/ depending on whether it preceded a front vowel letter or not. The convention of using both ⟨c⟩ and ⟨k⟩ was applied to the writing of English after the Norman Conquest, causing a considerable re-spelling of the Old English words. Thus while Old English candel, clif, corn, crop, cú, remained unchanged, Cent, cǣᵹ (cēᵹ), cyng, brece, sēoce, were now (without any change of sound) spelled Kent, keȝ, kyng, breke, and seoke; even cniht ('knight') was subsequently changed to kniht and þic ('thick') changed to thik or thikk. The Old English ⟨cw⟩ was also at length displaced by the French ⟨qu⟩ so that the Old English cwēn ('queen') and cwic ('quick') became Middle English quen and quik, respectively. The sound [tʃ], to which Old English palatalized /k/ had advanced, also occurred in French, chiefly from Latin /k/ before ⟨a⟩. In French it was represented by the digraph ⟨ch⟩, as in champ (from Latin camp-um) and this spelling was introduced into English: the Hatton Gospels, written c. 1160, have in Matt. i-iii, child, chyld, riche, mychel, for the cild, rice, mycel, of the Old English version whence they were copied. In these cases, the Old English ⟨c⟩ gave way to ⟨k⟩, ⟨qu⟩ and ⟨ch⟩; on the other hand, ⟨c⟩ in its new value of /ts/ appeared largely in French words like processiun, emperice and grace, and was also substituted for ⟨ts⟩ in a few Old English words, as miltse, bletsien, in early Middle English milce, blecien. By the end of the thirteenth century both in France and England, this sound /ts/ de-affricated to /s/; and from that time ⟨c⟩ has represented /s/ before front vowels either for etymological reasons, as in lance, cent, or to avoid the ambiguity due to the "etymological" use of ⟨s⟩ for /z/, as in ace, mice, once, pence, defence.

Thus, to show etymology, English spelling has advise, devise (instead of *advize, *devize), while advice, device, dice, ice, mice, twice, etc., do not reflect etymology; example has extended this to hence, pence, defence, etc., where there is no etymological reason for using ⟨c⟩. Former generations also wrote sence for sense. Hence, today the Romance languages and English have a common feature inherited from Vulgar Latin spelling conventions where ⟨c⟩ takes on either a "hard" or "soft" value depending on the following letter.

Pronunciations of Cc
Most common pronunciation: /k/

Languages in italics do not use the Latin alphabet

Language Dialect(s) Pronunciation (IPA) Environment Notes
Albanian /ts/
Arabic Cypriot Arabic /ʕ/ Latinization
Azeri /dʒ/
Berber /ʃ/ Latinization
Bukawa /ʔ/
Catalan /k/
/s/ Before e, i
Crimean Tatar /dʒ/
Cornish /s/ Standard Written Form
Czech /ts/
Danish /k/
/s/ Before e, i, y, æ, ø
Dutch /k/
/s/ Before e, i, y
/tʃ/ Before e, i,y in loanwords from Italian
English /k/
/s/ Before e, i, y
Fijian /ð/
Filipino /k/
/s/ Before e, i
French /k/
/s/ Before e, i, y
Fula /tʃ/
Gagauz /dʒ/
Galician /k/
/θ/ Before e, i
/s/ Before e, i in seseo zones
Hausa /tʃ/
Hungarian /ts/
Indonesian /tʃ/
Irish /k/
/c/ Before e, i; or after i
Italian /k/
/tʃ/ Before e, i
Kurdish Kurmanji /dʒ/
Latvian /ts/
Malay /tʃ/
Mandarin Standard /tsʰ/ Pinyin latinization
Manding /tʃ/
Polish /ts/
Portuguese /k/
/s/ Before e, i, y
Romanian /tʃ/ Before e, i
/k/
Romansh /ts/ Before e, i
/k/
Scottish Gaelic /kʰ/
/kʰʲ/ Before e, i; or after i
Serbo-Croatian /ts/
Slovak /ts/
Slovene /ts/
Somali /ʕ/
Spanish All /k/
Most of European /θ/ Before e, i, y
American, Andalusian, Canarian /s/ Before e, i, y
Swedish /k/
/s/ Before e, i, y, ä, ö
Tatar /ʑ/
Turkish /dʒ/
Valencian /k/
/s/ Before e, i
Vietnamese /k/
/k̚/ Word-final
/kp/ Word-final after u, ô, o
Welsh /k/
Xhosa /ǀ/
Yabem /ʔ/
Yup'ik /tʃ/
Zulu /ǀ/

In English orthography, ⟨c⟩ generally represents the "soft" value of /s/ before the letters ⟨e⟩ (including the Latin-derived digraphs ⟨ae⟩ and ⟨oe⟩, or the corresponding ligatures ⟨æ⟩ and ⟨œ⟩), ⟨i⟩, and ⟨y⟩, and a "hard" value of /k/ before any other letters or at the end of a word. However, there are a number of exceptions in English: "soccer" and "Celt" are words that have /k/ where /s/ would be expected.

The "soft" ⟨c⟩ may represent the /ʃ/ sound in the digraph ⟨ci⟩ when this precedes a vowel, as in the words 'delicious' and 'appreciate', and also in the word "ocean" and its derivatives.

The digraph ⟨ch⟩ most commonly represents //, but can also represent /k/ (mainly in words of Greek origin) or /ʃ/ (mainly in words of French origin). For some dialects of English, it may also represent /x/ in words like loch, while other speakers pronounce the final sound as /k/. The trigraph ⟨tch⟩ always represents //.

The digraph ⟨ck⟩ is often used to represent the sound /k/ after short vowels, like "wicket".

C is the twelfth most frequently used letter in the English language (after E, T, A, O, I, N, S, H, R, D, and L), with a frequency of about 2.8% in words.

Other languages

In the Romance languages French, Spanish, Italian, Romanian and Portuguese, ⟨c⟩ generally has a "hard" value of /k/ and a "soft" value whose pronunciation varies by language. In French, Portuguese, Catalan and Spanish from Latin America and some places in Spain, the soft ⟨c⟩ value is /s/ as it is in English. In the Spanish spoken in most of Spain, the soft ⟨c⟩ is a voiceless dental fricative /θ/. In Italian and Romanian, the soft ⟨c⟩ is [t͡ʃ].

Germanic languages usually use c for Romance loans or digraphs, such as ⟨ch⟩ and ⟨ck⟩, but the rules vary across languages. Dutch uses ⟨c⟩ the most, for all Romance loans and the digraph ⟨ch⟩, but unlike English, does not use ⟨c⟩ for native Germanic words like komen, "come". German uses ⟨c⟩ in the digraphs ⟨ch⟩ and ⟨ck⟩, and the trigraph ⟨sch⟩, but only by itself in unassimilated loanwords and place names. Danish keeps soft ⟨c⟩ in Romance words but changes hard ⟨c⟩ to ⟨k⟩. Swedish has the same rules for soft and hard ⟨c⟩ as Danish, and also uses ⟨c⟩ in the digraph ⟨ck⟩ and the very common word och, "and". Norwegian, Afrikaans, and Icelandic are the most restrictive, replacing all cases of ⟨c⟩ with ⟨k⟩ or ⟨s⟩, and reserving ⟨c⟩ for unassimilated loanwords and names.

All Balto-Slavic languages that use the Latin alphabet, as well as Albanian, Hungarian, Pashto, several Sami languages, Esperanto, Ido, Interlingua, and Americanist phonetic notation (and those aboriginal languages of North America whose practical orthography derives from it) use ⟨c⟩ to represent /t͡s/, the voiceless alveolar or voiceless dental sibilant affricate. In Hanyu Pinyin, the standard romanization of Mandarin Chinese, the letter represents an aspirated version of this sound, /t͡sh/.

Among non-European languages that have adopted the Latin alphabet, ⟨c⟩ represents a variety of sounds. Yup'ik, Indonesian, Malay, and a number of African languages such as Hausa, Fula, and Manding share the soft Italian value of /t͡ʃ/. In Azeri, Crimean Tatar, Kurmanji Kurdish, and Turkish ⟨c⟩ stands for the voiced counterpart of this sound, the voiced postalveolar affricate /d͡ʒ/. In Yabem and similar languages, such as Bukawa, ⟨c⟩ stands for a glottal stop /ʔ/. Xhosa and Zulu use this letter to represent the click /ǀ/. In some other African languages, such as Berber languages, ⟨c⟩ is used for /ʃ/. In Fijian, ⟨c⟩ stands for a voiced dental fricative /ð/, while in Somali it has the value of /ʕ/.

The letter ⟨c⟩ is also used as a transliteration of Cyrillic ⟨ц⟩ in the Latin forms of Serbian, Macedonian, and sometimes Ukrainian, along with the digraph ⟨ts⟩.

Other systems

As a phonetic symbol, lowercase ⟨c⟩ is the International Phonetic Alphabet (IPA) and X-SAMPA symbol for the voiceless palatal plosive, and capital ⟨C⟩ is the X-SAMPA symbol for the voiceless palatal fricative.

Digraphs

There are several common digraphs with ⟨c⟩, the most common being ⟨ch⟩, which in some languages (such as German) is far more common than ⟨c⟩ alone. ⟨ch⟩ takes various values in other languages.

As in English, ⟨ck⟩, with the value /k/, is often used after short vowels in other Germanic languages such as German and Swedish (other Germanic languages, such as Dutch and Norwegian, use ⟨kk⟩ instead). The digraph ⟨cz⟩ is found in Polish and ⟨cs⟩ in Hungarian, representing /t͡ʂ/ and /t͡ʃ/ respectively. The digraph ⟨sc⟩ represents /ʃ/ in Old English, Italian, and a few languages related to Italian (where this only happens before front vowels, while otherwise it represents /sk/). The trigraph ⟨sch⟩ represents /ʃ/ in German.

 

A curled C in the coat of arms of Porvoo

  • 𐤂 : Semitic letter Gimel, from which the following symbols originally derive
    • Γ γ : Greek letter Gamma, from which C derives
      • G g : Latin letter G, which is derived from Latin C
        • Ȝ ȝ : Latin letter Ȝ, which is derived from Latin G
  • Phonetic alphabet symbols related to C:
    • ɕ : Small c with curl
    • ʗ : stretched C
  • ᶜ : Modifier letter small c[5]
  • ᶝ : Modifier letter small c with curl[5]
  • ᴄ : Small capital c is used in the Uralic Phonetic Alphabet.[6]
  • Ꞔ ꞔ : C with palatal hook, used for writing Mandarin Chinese using the early draft version of pinyin romanization during the mid-1950s[7]

Add to C with diacritics

  • C with diacritics: Ć ć Ĉ ĉ Č č Ċ ċ Ḉ ḉ Ƈ ƈ C̈ c̈ Ȼ ȼ Ç ç Ꞔ ꞔ Ꞓ ꞓ
  • Ↄ ↄ : Claudian letters[8]

Derived ligatures, abbreviations, signs and symbols

  • © : copyright symbol
  • ℃ : degree Celsius
  • ¢ : cent
  • ₡ : colón (currency)
  • ₢ : Brazilian cruzeiro (currency)
  • ₵ : Ghana cedi (currency)
  • ₠ : European Currency Unit CE
  • C {\displaystyle \mathbb {C} }   : blackboard bold C, denoting the complex numbers
  • ℭ : blackletter C
  • Ꜿ ꜿ : Medieval abbreviation for Latin syllables con- and com-, Portuguese -us and -os[9]

These are the code points for the forms of the letter in various systems

Character information
Preview C c
Unicode name LATIN CAPITAL LETTER C LATIN SMALL LETTER C
Encodings decimal hex dec hex
Unicode 67 U+0043 99 U+0063
UTF-8 67 43 99 63
Numeric character reference &#67; &#x43; &#99; &#x63;
EBCDIC family 195 C3 131 83
ASCII 1 67 43 99 63
1 Also for encodings based on ASCII, including the DOS, Windows, ISO-8859 and Macintosh families of encodings.

In Unicode, C is also encoded in various font styles for mathematical purposes; see Mathematical Alphanumeric Symbols.

NATO phonetic Morse code
Charlie
   ▄▄▄ ▄ ▄▄▄ ▄ 
       
Signal flag Flag semaphore American manual alphabet (ASL fingerspelling) British manual alphabet (BSL fingerspelling) Braille dots-14
Unified English Braille

In the hexadecimal (base 16) numbering system, C is a number that corresponds to the number 12 in decimal (base 10) counting.

  • Hard and soft C
  • Speed of light, c

  1. ^ "C" Oxford English Dictionary, 2nd edition (1989); Merriam-Webster's Third New International Dictionary of the English Language, Unabridged (1993); "cee", op. cit.
  2. ^ Powell, Barry B. (27 Mar 2009). Writing: Theory and History of the Technology of Civilization. Wiley Blackwell. p. 182. ISBN 978-1405162562.
  3. ^ Sihler, Andrew L. (1995). New Comparative Grammar of Greek and Latin (illustrated ed.). New York: Oxford University Press. p. 21. ISBN 0-19-508345-8.
  4. ^ "Reading Middle Welsh -- 29 Medieval Spelling". www.mit.edu. Retrieved 2019-11-19.
  5. ^ a b Constable, Peter (2004-04-19). "L2/04-132 Proposal to add additional phonetic characters to the UCS" (PDF).
  6. ^ Everson, Michael; et al. (2002-03-20). "L2/02-141: Uralic Phonetic Alphabet characters for the UCS" (PDF).
  7. ^ West, Andrew; Chan, Eiso; Everson, Michael (2017-01-16). "L2/17-013: Proposal to encode three uppercase Latin letters used in early Pinyin" (PDF).
  8. ^ Everson, Michael (2005-08-12). "L2/05-193R2: Proposal to add Claudian Latin letters to the UCS" (PDF).
  9. ^ Everson, Michael; Baker, Peter; Emiliano, António; Grammel, Florian; Haugen, Odd Einar; Luft, Diana; Pedro, Susana; Schumacher, Gerd; Stötzner, Andreas (2006-01-30). "L2/06-027: Proposal to add Medievalist characters to the UCS" (PDF).

  •   Media related to C at Wikimedia Commons
  •   The dictionary definition of C at Wiktionary
  •   The dictionary definition of c at Wiktionary

Retrieved from "https://en.wikipedia.org/w/index.php?title=C&oldid=1092944888"