Advertisement
Tech

Syntax Rules and the C Character Set

In this article, we discuss some basic concepts you need to know to write programs in the C programming language. We explain what syntax rules are and the role of the C alphabet.

By Noel Kalicharan
Desk Tech
Reading time 3 min read
Word count 579
Linux Computing Linux commands
Syntax Rules and the C Character Set
Advertisement
Quick Take

In this article, we discuss some basic concepts you need to know to write programs in the C programming language. We explain what syntax rules are and the role of the C alphabet.

On this page

C - the basics

A programming language is similar to spoken languages in many respects. It has an alphabet (more commonly referred to as a character set) from which everything in the language is constructed. It has rules for forming words (also called tokens), rules for forming statements, and rules for forming programs.

These are called the syntax rules of the language and must be obeyed when writing programs. If you violate a rule, your program will contain a syntax error. When you attempt to compile the program, the compiler will inform you of the error. You must correct it and try again.

Advertisement

The first step in becoming a good programmer is learning the syntax rules of the programming language. This is the easy part and many people mistakenly believe that this makes them a programmer. It is like saying that learning some rules of English grammar and being able to write some correctly formed sentences make one a novelist.

Novel-writing skills require much more than learning some rules of grammar. Among other things, it requires insight, creativity and a knack for using the right words in a given situation.

Advertisement

In the same vein, a good programmer must be able to creatively use the features of the language to solve a wide variety of problems in an elegant and efficient manner. This is the difficult part; it can only be achieved by long, hard study of problem-solving algorithms and developing experience in writing programs to address diverse challenges. But we must start with baby steps.

The C Alphabet

We can think of the C alphabet as consisting of all the characters one could type on a standard English keyboard: the digits; uppercase and lowercase letters; and special characters such as +, =, <, >, & and %.

Advertisement

More formally, C uses the ASCII (American Standard Code for Information Interchange, pronounced ass-key) character set . This is a character standard which includes the letters, digits and special characters found on a standard keyboard. It also includes control characters such as backspace, tab, line feed, form feed and carriage return. Each character is assigned a numeric code. The ASCII codes run from 0 to 127.

The programs in this series will be written using the ASCII character set, which can be viewed here .

Advertisement

In the next article, we will take a look at C tokens.

References

References: C Programming – A Beginner’s Course

Advertisement

Related programming references

This post is part of the series: C Programming for Beginners

A straightforward introduction to Programming in C for people with no previous programing experience.

Advertisement
  1. C Programming For Beginners - Part 1
  2. C Programming For Beginners - Part 2
  3. C Programming for Beginners – Part 3
  4. C Programming for Beginners – Part 4
  5. C Programming For Beginners - Part 5
  6. C Programming For Beginners - Part 6
  7. C Programming For Beginners - Data Types
  8. C Programming For Beginners - Part 8
  9. C Programming For Beginners - Part 9
  10. C Programming For Beginners - Part 10
  11. C Programming For Beginners - Part 11
  12. C Programming For Beginners - Part 12
  13. C Programming For Beginners - Part 13
  14. C Programming For Beginners - Part 14
  15. C Programming For Beginners - Integer Data Types
  16. C Programming for Beginners - Part 16
  17. C Programming For Beginners - Integer Expressions, Operators and Precedence
  18. C Programming For Beginners - Part 18
  19. C Programming For Beginners - Printing Double and Float
  20. C Programming For Beginners - Mixing double, float and int
Keep Exploring

More from Tech

Filed under
Linux Computing
More topics
Linux commands
Advertisement