35

I know this is a common convention, but what does the "k" in variable names signify? (i.e. kMaxImageViewSize) I looked in the Apple documentation on Variable names and found no mention of it.

Thanks for answering

Corey Floyd
  • 25,929
  • 31
  • 126
  • 154

2 Answers2

71

That's a general programming notation not specific to Objective-C (i.e. Hungarian Notation) and the "k" stands for "constant".

Marc Novakowski
  • 44,628
  • 11
  • 58
  • 63
25

I would presume it means "konstant". :-)

C. K. Young
  • 219,335
  • 46
  • 382
  • 435
  • 3
    Actually, it’s koefficient. Old mathematical tradition. :-) – Jens Ayton Jan 23 '09 at 07:34
  • 17
    “Koeffizient” is the German word for “coefficient“ i.e. a multiplication factor, whereas “Konstante” means the noun “constant“, which would here be appropriate. As the prefix “k” comes from the Hungarian notation, i would rather believe that it is derived from the Hungarian noun “konstans”, which also means “constant”. – Michael Manner Aug 22 '12 at 06:11
  • Sorry @michael-manner, "k" does not come from Hungarian. Look at the wikipedia entry, or the MSDN article; there is no mention of a "k" prefix and the only mention of anything special for constants is mentioned in passing when MSDN notes "Even if we know that it is a constant (because it is spelled all caps, for example), there might be several color-related types." – jorgbrown Oct 23 '17 at 09:22
  • Now we historians need to find out the back story of the mysterious `k` used by ancestors since dozens of years ago. – jackxujh Dec 09 '19 at 01:49