Learn Best Keywords and Identifiers in C-Learncoding

Define Keywords and Identifiers in C Language

Keywords: Keyword is a reserved keyword in c language. It is used to create data types or identifiers. C language keyword are used to every c program used.
Keyword can not be used variable name.


Learn Best Keywords and Identifiers in C
Learn Best Keywords and Identifiers in C


    autobreakcase
    charconstcontinue
    defaultdodouble
    elseenumextern

    floatforgoto
    ifintlong
    signedsizeofstatic
    structswitchtypedef

    unionunsignedvoid
    volatilewhilemalloc
    callocreallocfree

    Special Characters in C

         Special Characters in C Programming
    ,._
    -:;
    {}(
    # $!
    ^&*
    ?/|
    \"%
    %c%d%f
    [])
    <>~
    !@&*
    %u&a%

    C Keywords List or Description

    Auto Keyword in C

    Auto Keywords: The auto keyword defines automatic variables.

    auto int variable_name;


    This statement define that variable_name is storage class auto and data type int. automatic variables are local to a function, they are also called local variables. 

    #include<stdio.h>

    #include<conio.h>

    void main()

    {

     auto int a=100;

    printf("Value of a:%d", a);

    getch();

    }


    **********OUTPUT**********

    Value of a:100


    What is the use of break keyword in C

    Break Keyword: A break keyword is used to terminates the loop immediately when it is encountered. break keyword is used to terminate the switch statement in c language.

    #include<stdio.h>

    #include<conio.h>

    void main()

    {

     int n;

    printf("Enter a number:");

    scanf("%d", &n);


    switch(n)

    {

      case 1:

                  printf("Case one executed");

                  break;

     case 2:

                  printf("Case two executed");

                  break;

     case 3:

                   printf("Case three executed");

                   break;

     case 4:

                   printf("Case four executed");

                   break;

     case 5:

                   printf("Case five executed");

                   break;

    default:

                  printf("invalid input");

    }

    getch();

    }


    **********OUTPUT**********

    Enter a number: 4

    Case four executed


    Continue Keyword in C

    Continue Keyword: Continue keyword used to statement skips the statements after it inside the loop for iteration.

    #include<stdio.h>

    #include<conio.h>

    void main()

    {

       for(int i=1;i<=10;i++)

         if(i==3)

           continue;

           printf("%d\n",i);

    }

    getch();

    }


    **********OUTPUT**********

    1

    2

    4

    5

    6

    7

    8

    9

    10


    Case Keyword in C

    Case keyword: Case keyword used in switch statement. The switch statement is used if a block of statement can be executed among many blocks. 

    #include<stdio.h>

    #include<conio.h>

    void main()

    {

     int n;

    printf("Enter a number:");

    scanf("%d", &n);


    switch(n)

    {

      case 1:

                  printf("Case one executed");

                  break;

     case 2:

                  printf("Case two executed");

                  break;

     case 3:

                   printf("Case three executed");

                   break;

    default:

                  printf("invalid input");

    }

    getch();

    }


    **********OUTPUT**********

    Enter a number: 2

    Case two executed


    Char keyword in C

    Char Keyword: Char keyword declared a character variable. char keyword use in character value define in c language.

    #include<stdio.h>

    #include<conio.h>

    void main()

    {

     char a='A';

    printf("Character Value of a:%c", a);

    getch();

    }


    **********OUTPUT**********

    Character Value of a:A


    Const Keyword in C

    Const keyword: Const keyword is used to constantly value. constant value never changes dynamically.

    #include<stdio.h>

    #include<conio.h>

    void main()

    {

     int x=500;

    printf("Value of x:%d", x);

    getch();

    }


    **********OUTPUT**********

    Value of x:500


    Do Keyword in C

    do Keyword:Do keyword used to do-while loop in c language. It is very important in c language.

    #include<stdio.h>

    #include<conio.h>

    void main()

    {

     int i=1;

    do

    {


    printf("Value of i:%d ", i);

    while(i<=10);

    i=i+1;

    }

    getch();

    }


    **********OUTPUT**********

    Value of i:1 2 3 4 5 6 7 8 9 10


    Example of Double Data Type in C

    #include<stdio.h>

    #include<conio.h>

    void main()

    {

     double x=76800;

    printf("Value of x:%d", x);

    getch();

    }


    **********OUTPUT**********

    Value of x:76800


    Why is if-else used in C

    if-else keyword: if-else keyword is used to decisions making in c language.

    #include<stdio.h>

    #include<conio.h>

    void main()

    {

     int age=18;

    if(age>=18);

    {

    printf("Your age is greater than18");

    }

    else

    {

    printf("Your age is less than 18");

    }

    getch();

    }


    **********OUTPUT**********

    Your age is greater than18


    Enum Keyword in C

    Enum Keyword: Enumeration Keyword is used to collection of name integer constant. Enum is a user defined data type.

    #include<stdio.h>

    #include<conio.h>

    enum week{Sunday=5,Monday=6,Thursday =7,Wednesday=9,Thursday=8, Friday=11,Saturday};

    void main()

    {

     enum week data;

    data=Wednesday;

    printf("Value data:%d", data);

    getch();

    }


    **********OUTPUT**********

    Value of data:9


    Extern Keyword in C

    Extern keyword: Extern keyword used that a variable or function has external linking outside the file of declared.

    File A.c

    #include<stdio.h>

    #include<conio.h>

    void main()

    {

     int x=100;

    printf("Value of x:%d", x);

    getch();

    }


    File B.c

    #include<stdio.h>

    #include<conio.h>

    #include extern A.c

    void main()

    {

     extern int x;

    printf("Value of x:%d", x);

    getch();

    }



    **********OUTPUT**********

    Value of x:100

    Float Keyword in C

    Float Keyword: Float keyword is used to floating point number stored in c language. float data types defferent size or range in c language.

    #include<stdio.h>

    #include<conio.h>

    void main()

    {

     float x=76.80;

    printf("Value of x:%f", x);

    getch();

    }


    **********OUTPUT**********

    Value of x:76.80

    Goto Keyword in C

    Goto Keyword: Goto keyword is used to transfer the control of the program to the specified label in c program.

    #include<stdio.h>

    #include<conio.h>

    void main()

    {

     for(i=1; i<5; ++i)

    {

        if (i==10)

        goto level;

    }

    printf("i is not 10");

    level:

        printf("level, count cannot be 10");

    getch();

    }


    **********OUTPUT**********

    level, count cannot be 10

    int Keyword in C

    int keyword: A int keyword is used to declare integer type variables. integer data types can be holds only integer value.

    #include<stdio.h>

    #include<conio.h>

    void main()

    {

     int x=768;

    printf("Value of x:%d", x);

    getch();

    }


    **********OUTPUT**********

    Value of x:768

    Short, Long, Signed and Unsigned Data Types

    Keyword: The short data type, long data type, signed and unsigned keywords are type modifiers that alter the meaning of a base data types in c language.

    #include<stdio.h>

    #include<conio.h>

    void main()

    {

     short int a=768;

     long int b=65564;

    printf("Value of a:%d", a);

    printf("Value of b:%d", b);

    getch();

    }


    **********OUTPUT**********

    Value of a:768

    Value of b:65564

    Return Keyword in C

    return keyword: A return keyword can be used to terminates the function and returns the value of c language.

    #include<stdio.h>

    #include<conio.h>

    int add()

    {

        int a=10;

        int b=20;

        int c=a+b;

        return c;

    }

    int main()

    {

     printf("Value of c:%d",c);

    getch();

    }


    **********OUTPUT**********

    Value of c:30

    Sizeof keyword in C

    sizeof keyword: A sizeof keyword is used to evaluates the size of data  value in c language.

    #include<stdio.h>

    #include<conio.h>

    void main()

    {

     int x=76;

    printf("size of x:%d", sizeof(x));

    getch();

    }


    **********OUTPUT**********

    Size of x:4

    Register Keyword in C

    Register Keyword: A register keyword is used to create register variables which are much faster than normal variables. because register variable nearby CPU.

    #include<stdio.h>

    #include<conio.h>

    void main()

    {

     register int x=76;

    printf("Value of x:%d", x);

    getch();

    }


    **********OUTPUT**********

    Value of x:76


    Static Keyword in C

    Static Keyword: Static keyword use to create a static variable. Static variable are using static value.

    #include<stdio.h>

    #include<conio.h>

    int add()

    {

    {

    static int i=0;

    printf("%d\n",i);

    i++;

    }

    }

    int main()

    {  

    add();

    add();

            add();

    }


    **********OUTPUT**********

    0

    1

    2

    Struct Keyword in C

    Struct Keyword: Struct keyword is used to collection of data or different data types. It is a user data types. 

    #include<stdio.h>

    #include<string.h>

    struct Employee

    {

    int id;

    char name[50];

    int salary;

    };

    int main()

    {   

        struct Employee e[10];

        int n;

    printf("Enter Employee Number:");

    scanf("%d",&n);

    for(int i=0;i<n;i++)

    {

    printf("Enter Employee Id:");

    scanf("%d",&e[i].id);

    printf("Enter Employee Name:");

        scanf("%s",e[i].name);

    printf("Enter Employee Salary:");

    scanf("%d",&e[i].salary);

    }

    printf("--------------------------------\n");

    for(int i=0;i<n;i++)

    {

    printf("Employee Id:%d\n",e[i].id);

    printf("Employee Name:%s\n",e[i].name);

    printf("Employee Salary:%d\n",e[i].salary);

        printf("--------------------------------\n");

    }

    }


    **********OUTPUT**********

    Enter Employee Number:1

    Enter Employee Id:6463

    Enter Employee Name:Nivi

    Enter Employee Salary:67577

    --------------------------------

    Employee Id:6463

    Employee Name: Nivi

    Employee Salary:67577

    Union Keyword in C

    Union Keyword: Union is a collection of data or different data types.union data types is a user defind data types. Union does not support multiple value. Union  can be store only one value at a time.

    #include<stdio.h>

    #include<string.h>

    union Employee

    {

    int id;

    char name[50];

    int salary;

    };

    int main()

    {   

        union Employee e[10];

        int n;

    printf("Enter Employee Number:");

    scanf("%d",&n);

    for(int i=0;i<n;i++)

    {

    printf("Enter Employee Id:");

    scanf("%d",&e[i].id);

    printf("Enter Employee Name:");

        scanf("%s",e[i].name);

    printf("Enter Employee Salary:");

    scanf("%d",&e[i].salary);

    }

    printf("--------------------------------\n");

    for(int i=0;i<n;i++)

    {

    printf("Employee Id:%d\n",e[i].id);

    printf("Employee Name:%s\n",e[i].name);

    printf("Employee Salary:%d\n",e[i].salary);

        printf("--------------------------------\n");

    }

    }


    **********OUTPUT**********

    Enter Employee Number:1

    Enter Employee Id:6463

    Enter Employee Name:Nivi

    Enter Employee Salary:67577

    --------------------------------

    Employee Id:67577

    Employee Name:∙☺

    Employee Salary:67577

    Typedef Keyword in C

    Typedef Keyword: Typedef keyword is used to short name of long variale. it is most useful data types in c language.

    #include<stdio.h>

    #include<conio.h>

    typedef struct learncoding

    {

      int id;

    }learcoding;

    int main()

    {

        learncoding lc;

    lc.id=457;

    printf("Id is:%d",lc.id);

    getch();

    }


    **********OUTPUT**********

    Id is: 457

    Void Keyword in C

    Void Keyword: Void keyword is used to no return type void keyword no value

    #include<stdio.h>

    #include<conio.h>

    void main()  // void keyword use in c program

    {

     int x=400;

    printf("Value of x:%d", x);

    getch();

    }


    **********OUTPUT**********

    Value of x:400


    Post a Comment

    0 Comments