Introduction to C Programing

 
Learning C Programming :






C is a procedural programming language. It was initially developed by Dennis Ritchie as a system programming language to write an operating system. The main features of C language include low-level access to memory, simple set of keywords, and a clean style, these features make C language suitable for system programming like operating system or compiler development

Introduction


C Keywords and Identifiers

In this tutorial, you will learn about keywords; reserved words in C programming that are part of the syntax. Also, you will learn about identifiers and how to name them.

Character set

A character set is a set of alphabets, letters and some special characters that are valid in C language.



C accepts both lowercase and uppercase alphabets as variables and functions.

Digits


Special Characters


White space Characters

Blank space, newline, horizontal tab, carriage return and form feed.


C Keywords


Keywords are predefined, reserved words used in programming that have special meanings to the compiler. Keywords are part of the syntax and they cannot be used as an identifier. For example:


Here, int is a keyword that indicates money is a variable of type int (integer).

As C is a case sensitive language, all keywords must be written in lowercase. Here is a list of all keywords allowed in ANSI C.




C Identifiers

Identifier refers to name given to entities such as variables, functions, structures etc.

Identifiers must be unique. They are created to give a unique name to an entity to identify it during the execution of the program. For example:


Here, money and accountBalance are identifiers.

Also remember, identifier names must be different from keywords. You cannot use int as an identifier because int is a keyword.



Rules for naming identifiers

  1. A valid identifier can have letters (both uppercase and lowercase letters), digits and underscores.
  2. The first letter of an identifier should be either a letter or an underscore.
  3. You cannot use keywords like intwhile etc. as identifiers.
  4. There is no rule on how long an identifier can be. However, you may run into problems in some compilers if the identifier is longer than 31 characters.

You can choose any name as an identifier if you follow the above rule, however, give meaningful names to identifiers that make sense. 

C Variables, Constants and Literals

In programming, a variable is a container (storage area) to hold data.

To indicate the storage area, each variable should be given a unique name (identifier). Variable names are just the symbolic representation of a memory location. For example:



Here, playerScore is a variable of int type. Here, the variable is assigned an integer value 95.

The value of a variable can be changed, hence the name variable.





Brand creation, trend analysis & style consulting

Our content is highly curated—in partnership with industry leaders from Google, Amazon, and Microsoft—to advance expertise in data science, ML, cloud computing, cybersecurity, and more. From our individual courses to our highly valued Nanodegree credential, each program is deeply focused on a single concept, eliminating guesswork in selecting the right course to overcome talent gaps.

Contact