Constants are names given to entities that cannot be modified during the execution of program. They are fixed values. Types of constants in C are -
1. Integer constant
2. Character constant
3. Floating point constant
4. String constant
5. Enumeration constant
Example
#include<stdio.h>
#include<conio.h>
void main()
{
int q = 9 ;
const int a = 10 ;
q = 15 ;
a = 100 ; // creates an error
printf(“q = %d\na = %d”, q, a ) ;
}
The program given above creates an error. It is because we are trying to change the value of the constant variable (a = 100).
Constants are names given to entities that cannot be modified during the execution of program. They are fixed values. Types of constants in C are -
1. Integer constant
2. Character constant
3. Floating point constant
4. String constant
5. Enumeration constant
Example
#include<stdio.h>
#include<conio.h>
void main()
{
int q = 9 ;
const int a = 10 ;
q = 15 ;
a = 100 ; // creates an error
printf(“q = %d\na = %d”, q, a ) ;
}
The program given above creates an error. It is because we are trying to change the value of the constant variable (a = 100).
The C language is a high-level, general-purpose programming language. It provides a straightforward, consistent, powerful interface for programming systems. That's why the C language is widely used for developing system software, application software, and embedded systems.The C programming language has been highly influential, and many other languages have been derived from it.
While C is one of the easy languages, it is still a good first language choice to start with because almost all programming languages are implemented in it. It means that once you learn C language, it’ll be easy to learn more languages like C++, Java, and C#.
Understand the type of data that you are working with, such as whether it’s an integer or a character. C is based on data types, so understanding this characteristic is the foundation for writing programs that work well.Learn the operators. Operators are symbols that tell the compiler program what to do.
The break is a keyword in C which is used to bring the program control out of the loop. The break statement is used inside loops or switch statement. The break statement breaks the loop one by one, i.e., in the case of nested loops, it breaks the inner loop first and then proceeds to outer loops.
Copyrights © 2024 letsupdateskills All rights reserved