c_programming
c_programming
It is a powerful and flexible language which was first developed for the
programming of the UNIX operating System.
Program:
#include <stdio.h>
int main() {
printf(“Welcome to Raaya Infotech Solutions!!”);
return 0;
}
Output:
Welcome to Raaya Infotech Solutions!!
C Variables
Syntax:
data_type variable_name; // defining single variable
data_type variable_name1, variable_name2; // defining multiple variable
C Variables
2.Variable Initialization
Variables can be initialized when they are declared. Initialization assigns
an initial value to the variable.
These are the statements that are not executed by the compiler or an
interpreter.
C Comments
Types of comments in C
In C there are two types of comments in C language:
• Single-line comment: A single-line comment in C starts with double
forward slash( // ) .
Each variable has an associated data type. It specifies the type of data
that the variable can store like integer, character, floating, double, etc.
Size: 1 byte
Format Specifier: %c
Syntax of char: char var_name; (The char keyword is used to declare
the variable of character type)
Data Types
It does not provide a result value to its caller. It has no values and no
operations. It is used to represent nothing.
The memory size refers to how much space a type occupies in the
computer's memory.
To actually get the size (in bytes) of a data type or variable, use the sizeof
operator,
Input and Output
C provides a standard set of functions to handle input from the user and
output to the screen or to files.
The most commonly used functions for Input/Output are scanf() and
printf() respectively.
Input and Output
Syntax:
printf(“formatted_string”, variables/values);
Input and Output
Syntax:
scanf (“formatted_string”, address_of_variables/);
Format Specifiers
The format specifier in C is used to tell the compiler about the type of
data to be printed or scanned in input and output operations.
They always start with a % symbol and are used in the formatted string
in functions like printf(), scanf(), etc.
Format Specifiers
Keywords in C
These names are used to uniquely identify and reference these entities
within the program. Identifiers follow certain rules and conventions:
4.They cannot be a keyword or reserved word in C. For example, int, for, if, etc., are
reserved for specific purposes and cannot be used as identifiers.
If you don't want others (or yourself) to change existing variable values, you can use
the const keyword.
If you don't want others (or yourself) to change existing variable values, you can use
the const keyword.