Explore the fundamentals of C programming on this page, delving into essential concepts such as tokens, keywords, identifiers, constants, strings, special symbols, and operators. Gain a comprehensive understanding of each element, equipping yourself with the foundational knowledge needed to excel in C programming. Uncover the intricacies of these key components through our detailed explanations and examples, empowering you to navigate the world of C programming with confidence and expertise.
Tokens are some of the most significant components utilized in the C programming language. Tokens in C are the smallest individual components of a program that are relevant to the operation of a compiler.
A token is the smallest unit of measurement in a C program. Every punctuation mark and word in a C program is a token. A compiler converts a C program into tokens before moving on to the next steps of the compilation process.
Keywords are reserved words in C that are connected with certain qualities. These terms assist us in utilizing the C language's capabilities. They have a specific significance for the compilers.
Keywords | Keywords | Keywords | Keywords |
---|---|---|---|
auto | else | long | switch |
break | enum | register | typedef |
case | extern | return | union |
char | float | short | unsigned |
const | for | signed | void |
continue | goto | sizeof | volatile |
default | if | static | while |
do | int | struct | _Packed |
double |
#include<stdio.h>
int main() {
// char, int and float are the keywords
char c = 'H';
int b = 6
float d = 7.6;
// if and else are the keyword
if(b < 5){
printf("Character Value is : %c",a1);
}
else{
printf("Float value is : %f",d);
}
return 0;
}
Float value is : 7.600000
In C program An identifier is used to identify a variable, functions or a user defined items. An identifier starts with a letter A to Z, a to z, or an underscore '_' followed by zero or more letters, underscores, and digits (0 to 9) as well as you must remember C program case sensitive. So you need aware of using these stuffs.These are names given to variables, functions, or user-defined data types. An identifier can be any combination of letters, digits, and underscore, but it must start with a letter or underscore. Examples of identifiers in C include "sum", "count", "total_sales", and "calculate_area".
These are fixed values that do not change during the execution of a program. There are several types of constants in C, including integer constants, floating-point constants, character constants, and string literals. Examples of constants in C include "25", "3.14", "'A'", and ""Hello, World!"". Constants are some fixed values which does not change, just like math. Constants of C Programming Language are three types. They are:
int a, b;
a = 10; //here 10 is constant
b = 15; //here 15 is constant
String is a set of caracters to more precise, an array of characters that ended with a null character is termed as a string. This null indicates the end of the string. Null character denotes by '\0\'. Some declarations for string are:
printf("Hello");//here Hello is a String
We are write lots of symbol in your codes like differnt brackets, semicolons etc that is call special symbol
int a;
a = 5; // here ; is a symbol
printf("%d",a); // here "" , and ; is symbol
The Operators in c programming are those, who trigger an action when that is applied to c variables as well as other objects. Depending on the number of operands that an operator can do or act, operators can be classified into two divisions and operands are those data on which operators act upon.
int a;
a = 5; // here = is a assignment operator
A Semicolons is called line terminator. Every individual line must terminate with Semicolons. For an example:
printf("hello");
return 0;
Comments are used for helping others people who are going read or trying to understand
your codes.There are two types of comments available in C program.
1. Single Line Comments. It starts
with //
2. Multiline Comments.It Starts with /* and ends with */
int b; //this is single line comment
/* this is multiline
comment */
int b; //this is single line comment
/* this is multiline
comment */