In case, of bonding with N,O or self catenation , carbon has a maximum double or triple bonds and it is because, two atoms can not have more than one sigma bond and two pi-bonds and so in alkynes two C-C atoms have triple bond only similarly in carbonyl groups it has >C=O (double bond with oxygen).
It could be explained as; the p-orbitals have only 3 sub orbitals px, py, pz in which pz is involved in making sigma bond and rest two can overlap sideways to form two pi -bonds only.
So, maximum bonds available between two carbon atoms are three.