C Programming Language Basic concepts

<<Previous

Next >>





Let us learn the basic fundamental concepts in the C programming language. We will learn the Keywords in C language, Syntax in C language, Character Set in C language, delimiters, and identifiers in C

If you wish to learn the C language from the very start, please start from here - C programming language.

Instructions in C, Keywords and Symbols in C programming language

A program is a set of instructions. Instructions are formed using certain words and symbols. C supports data used to write words and symbols such as numbers, characters, strings, and so on. Usually, words and symbols are written based on the syntax or the grammar rules of the language. In general, programmers need to follow the syntax rules of the language to write a program. Let us look at the basic syntax of the C programming language.

C Character Set

C Character Set is used to form words, numbers, and expressions. C Character Set is classified into different categories:

  • Letters in C programming language

    C uses the English Alphabet in both forms - Capital letter A to Z and Small letter a to z.

  • Digits

    C includes all decimal digits from 0 to 9.

  • White spaces in C

    C allows white spaces to be present in the statement. Spaces are used to separate words and statements and for better readability. Useful white spaces included in C are blank space, horizontal tab, vertical tab, and newline.

  • Special Characters in C programming

    C supports some kind of special characters or symbols. Following are the list of special characters:

    SymbolMeaningSymbolMeaning
    ,comma .period or dot
    ;semicolon :colon
    'apostrophequotation mark
    !exclamation mark|vertical bar
    /slash \back slash
    ~tilde _underscore
    $dollar?question mark
    &ampersand^caret
    *asteriskminus
    +plus <less than
    >greater than( )parenthesis
    [ ]bracket{ }brace
    %percent #number sign or Hash
    @at the rate =equals to

Delimiters in C programming

C uses special kind of symbols:

DelimitersUse
:     colon Useful for label
;     semicolon Terminates statement
( )   parenthesis Used in function and expression
[ ]   square bracket Used for array declaration
{ }   curly braceScope of the statement
#      hash Preprocessor directive
,      comma Variable separator

Keywords

C has some reserved words that are used by the compiler which have fixed meaning. We cannot use these keywords as a variable name or constant or function name. For using these keywords, we do not include any header file in our program. Following are the list of keywords; you should notice that all these keywords use lower case letter.

autodo intstruct
break elselongswitch
case externreturnunion
char enum registerunsigned
const floatshottypedef
continue forsignedvoid
double gotosizeofvolatile
defualtifstaticwhile

Identifiers in C programming

In C, identifiers are used to refer to several things; variable name, function name, and arrays. Identifiers in C are the user-defined names that consist of a sequence of letters, digits, and ' _ ' underscore.

The rules for defining an identifier:

  • The first character must be an alphabet.
  • The variable names may begin with '_' but this may be used only for library implementation.
  • An identifier may contain underscore and digits.
  • Reserved keywords may not be used as an identifier.
  • Use lower case letter for variable name and upper case letter for symbolic constant.
  • C is a case-sensitive programming language, so the identifier 'Woman' is different from the identifier 'woman'.

Examples

 Fact, myfunction, a, text, Text, _abc, sum, ADD, multi
 

<< Previous

Next >>




strcat() - String Concatenation        strcmp() - String Compare


strcpy() - String Copy        strlen() - String Length














C Programming Language Basic concepts

<<Previous

Next >>





Let us learn the basic fundamental concepts in the C programming language. We will learn the Keywords in C language, Syntax in C language, Character Set in C language, delimiters, and identifiers in C

If you wish to learn the C language from the very start, please start from here - C programming language.

Instructions in C, Keywords and Symbols in C programming language

A program is a set of instructions. Instructions are formed using certain words and symbols. C supports data used to write words and symbols such as numbers, characters, strings, and so on. Usually, words and symbols are written based on the syntax or the grammar rules of the language. In general, programmers need to follow the syntax rules of the language to write a program. Let us look at the basic syntax of the C programming language.

C Character Set

C Character Set is used to form words, numbers, and expressions. C Character Set is classified into different categories:

  • Letters in C programming language

    C uses the English Alphabet in both forms - Capital letter A to Z and Small letter a to z.

  • Digits

    C includes all decimal digits from 0 to 9.

  • White spaces in C

    C allows white spaces to be present in the statement. Spaces are used to separate words and statements and for better readability. Useful white spaces included in C are blank space, horizontal tab, vertical tab, and newline.

  • Special Characters in C programming

    C supports some kind of special characters or symbols. Following are the list of special characters:

    SymbolMeaningSymbolMeaning
    ,comma .period or dot
    ;semicolon :colon
    'apostrophequotation mark
    !exclamation mark|vertical bar
    /slash \back slash
    ~tilde _underscore
    $dollar?question mark
    &ampersand^caret
    *asteriskminus
    +plus <less than
    >greater than( )parenthesis
    [ ]bracket{ }brace
    %percent #number sign or Hash
    @at the rate =equals to

Delimiters in C programming

C uses special kind of symbols:

DelimitersUse
:     colon Useful for label
;     semicolon Terminates statement
( )   parenthesis Used in function and expression
[ ]   square bracket Used for array declaration
{ }   curly braceScope of the statement
#      hash Preprocessor directive
,      comma Variable separator

Keywords

C has some reserved words that are used by the compiler which have fixed meaning. We cannot use these keywords as a variable name or constant or function name. For using these keywords, we do not include any header file in our program. Following are the list of keywords; you should notice that all these keywords use lower case letter.

autodo intstruct
break elselongswitch
case externreturnunion
char enum registerunsigned
const floatshottypedef
continue forsignedvoid
double gotosizeofvolatile
defualtifstaticwhile

Identifiers in C programming

In C, identifiers are used to refer to several things; variable name, function name, and arrays. Identifiers in C are the user-defined names that consist of a sequence of letters, digits, and ' _ ' underscore.

The rules for defining an identifier:

  • The first character must be an alphabet.
  • The variable names may begin with '_' but this may be used only for library implementation.
  • An identifier may contain underscore and digits.
  • Reserved keywords may not be used as an identifier.
  • Use lower case letter for variable name and upper case letter for symbolic constant.
  • C is a case-sensitive programming language, so the identifier 'Woman' is different from the identifier 'woman'.

Examples

 Fact, myfunction, a, text, Text, _abc, sum, ADD, multi
 

<< Previous

Next >>






strncat() - String n Concatenation        strlwr() - String Lower       

strncmp() - String n Compare       strncpy() - String n Copy