CodersEditor Tutorials

CodersEditor Tutorials

  • Online IDE
  • Q&A
  • C Programming
  • Java
  • GraphQL.NET
  • System Software

›Introduction

C Programming

    Introduction

    • Overview
    • Installation & Setup
    • C Program Structure
    • Keywords & Identifiers
    • Data Types
    • Variables & Constants
    • Scope Rules
    • Storage Class
    • Standard Input and Output
    • Operators

    Control Flow/Decision Making

    • Overview
    • if Statement
    • if else Statement
    • Nested If statement
    • Switch Statement
    • Nested Switch Statement
    • Conditional Operators

    Loop

    • Loops Overview
    • While loop
    • For Loop
    • Do while
    • Nested Loops
    • Break
    • Continue Statement
    • Goto statement

    Arrays

    • Arrays
    • Multi Dimensional Arrays
    • Arrays & Functions

    Pointers

    • Pointers Basics
    • Pointers and Arrays
    • Pointers and Functions
    • Memory allocation

    Strings

    • String Basics
    • String Functions

    C Programming Examples

    • Basic Example 1

Keywords and Identifiers

In this article, you can learn about Keywords and Identifiers in the C programming language and the usage of these in your programs.

Keywords

Keywords in C are words that are preserved and have been described to the C compiler already. These are the pre-defined words and the meaning cannot be changed. And hence keywords cannot be used as variable names which will return an error.

In total there are 32 keywords in the C programming language.

autobreakcaseconstchar
continuedefaultdodoubleelse
enumexternfloatforgoto
ifintlongregisterreturn
shortsignedsizeofstaticstruct
switchtypedefunionunsignedvolatile
voidwhile

Let us look into some of the keywords and their functions in C.

Break Break, when used inside a loop it brings the program control out of the loop or terminates the loop immediately.

Continue The continue statement in a loop ends the current iteration and forces the next iteration to take place bypassing any other statements inside.

Switch The switch keyword is used to perform a block of statements that is when you have to execute a different task for each choice.

Int Keyword int declares the datatype integer.

Char This keyword char declares a character variable.

If…else In C programming, the if and else are looping statements used in decision making.

Goto Goto is used when you have to transfer the program control to a particular label.

Return The keyword return terminates the function and returns a value.

Void Void means no value or null.

Identifiers

The names given to constants, variables, functions and user-define data are known as Identifiers. It is assigned by the user in the program.

There are a set of rules to frame an Identifier.

  • An identifier can be of alphanumeric values only i.e letters and digits. (A-Z, a-z, 0-9)
  • Underscore _ can be used in an identifier.
  • Identifier names must be unique.
  • Keywords cannot serve as an Identifier.
  • No special character is allowed.
  • The first character of an identifier must be an alphabet or underscore.
  • Identifiers are case-sensitive.
  • No white spaces are allowed.

Below is an example of an Identifier and keyword.

int Total;
float student_percent;

Here int and float are keywords, Total and student_percent are identifier.

← C Program StructureData Types →
  • Keywords
  • Identifiers
CodersEditor Tutorials
CoderdEditor Developer Tools
CodersEditor Online EditorGit Flavoured Markup EditorFree Online JSON FormatterFind My IP Address Details
Tutorials
C ProgrammingJava
Copyright © 2021 CodersEditor.com