0

A variable in C can only have underscores, numbers and letters. But what letters? Does it mean the 26 alphabets of English only? Are letters of other language (like Hindi) allowed? What about characters like é and ì from other Latin based languages?

phuclv
  • 37,963
  • 15
  • 156
  • 475
Osmium
  • 169
  • 5
  • 1
    duplicates: [What constitutes a "valid" C Identifier?](https://stackoverflow.com/q/34319000/995714), [What are identifiers in C exactly?](https://stackoverflow.com/q/64841679/995714) – phuclv Oct 06 '22 at 03:57
  • Keep in mind C comes from the 1970s when 7-bit ASCII reigned supreme and UTF-8 was in the distant future where, according to popular television at the time, people would be living on the Moon and Mars. – tadman Oct 06 '22 at 04:13
  • The general rules for naming variables are: Names can contain letters, digits and underscores Names must begin with a letter or an underscore (_) Names are case sensitive (myVar and myvar are different variables) Names cannot contain whitespaces or special characters like !, #, %, etc. Reserved words (such as int) cannot be used as names – sahilatahar Oct 07 '22 at 05:59
  • @SahilAtahar that's not true at all. Modern C and some compiler extensions allow the use of Unicode characters in identifiers – phuclv Oct 09 '22 at 03:53

0 Answers0