constants

 //first way of defining constant

/*#include <stdio.h>
int main()
{
    const int a=6; // here we defined 'a' as constant
    //a=10; (here we can not change variable 'a' because we defined it as constant)
    printf("%d",a);
    return 0;
}*/

//second way of defining constant
#include <stdio.h>
#define a 10 // here we defined 'a' as constant
int main()
{
    printf("%d",a);
    return 0;
}

Comments

Popular posts from this blog

Tokens in C

Steps taken by a compiler to execute a C program

Variables and Data Types in C