What is the Lewis Structure for CO?

In many sites I see that they take $\ce{C}$ with valence 4, bur our teacher takes it with valence 2. With what valence should I take $\ce{C}$?




There is resonance between various Lewis structures as:


$$\ce{:\!\overset{\ominus}{C}#\overset{\oplus}{O}\!: ~<->~ :\!C=O\!:: ~<->~:\!\overset{\oplus}{C}-\overset{\ominus}{O}\!:::}$$


The term "valence" is not used much nowadays, and "oxidation state" is used but has a different meaning.


The [IUPAC definition of oxidation state](http://goldbook.iupac.org/O04365.html) requires the oxygen have a -2 oxidation state except in peroxides. All the oxidation states must add up to 0 for a neutral molecule. Therefore the oxidation state of carbon in CO must be +2.


There is an [IUPAC definition of valence](http://goldbook.iupac.org/V06588.html):



> 
> The maximum number of univalent atoms (originally hydrogen or chlorine atoms) that may combine with an atom of the element under consideration, or with a fragment, or for which an atom of this element can be substituted. 
> 
> 
> 


This imposes a unique valence upon each element, as explained in [this article](http://www.cs.mcgill.ca/~rwest/link-suggestion/wpcd_2008-09_augmented/wp/v/Valence_%2528chemistry%2529.htm), in which case valence is always 4 for carbon.


There are other definitions of "valence" such as:



> 
> The number of hydrogen atoms that can combine with an element in a binary hydride or twice the number of oxygen atoms combining with an element in its oxide or oxides
> 
> 
> 


(Chemistry of the Elements by Greenwood et al.)


According to this definition, carbon would have a valence of 2 in CO.


 11