Sei sulla pagina 1di 23

Introduction of Programming Paradigms

 Paradigm can also be termed as method to solve some problem or do some task.
 Programming paradigm is an approach to solve problem using some programming
language or also we can say it is a method to solve a problem using tools and
techniques that are available to us following some approach.

1.Imperative programming paradigm:


It is one of the oldest programming paradigm. It features close relation relation to
machine architecture.
 It is based on Von Neumann architecture.
 It works by changing the program state through assignment statements. It
performs step by step task by changing state.
 The main focus is on how to achieve the goal. The paradigm consist of several
statements and after execution of all the result is stored.

Advantage:
1. Very simple to implement
2. It contains loops, variables etc.
Disadvantage:
1. Complex problem cannot be solved
2. Less efficient and less productive
3. Parallel programming is not possible

Imperative programming is divided into three broad categories: Procedural, OOP and parallel
processing. These paradigms are as follows:
2.Procedural programming paradigm
 This paradigm emphasizes on procedure in terms of under lying machine model.
 There is no difference in between procedural and imperative approach.
 It has the ability to reuse the code and it was boon at that time when it was in use because
of its reusability.

3.Object oriented programming


 The program is written as a collection of classes and object which are meant for
communication. The smallest and basic entity is object and all kind of computation is
performed on the objects only.
 More emphasis is on data rather procedure.
 It can handle almost all kind of real life problems which are today in scenario.
Advantages:
 Data security
 Inheritance
 Code reusability
 Flexible and abstraction is also present

4.Parallel processing approach


 Parallel processing is the processing of program instructions by dividing them among
multiple processors.
 A parallel processing system posses many numbers of processor with the objective of
running a program in less time by dividing them.
 This approach seems to be like divide and conquer.
 Examples are NESL (one of the oldest one) and C/C++ also supports because of some
library function.
5. Declarative programming paradigm:
 It is divided as Logic, Functional, Database.
 In computer science the declarative programming is a style of building programs that
expresses logic of computation without talking about its control flow.
 It often considers programs as theories of some logic.It may simplify writing parallel
programs.
 The focus is on what needs to be done rather how it should be done basically emphasize
on what code code is actually doing.
 It just declare the result we want rather how it has be produced.
 This is the only difference between imperative (how to do) and declarative (what to do)
programming paradigms.

6.Logic programming paradigms


 It can be termed as abstract model of computation. It would solve logical problems like
puzzles, series etc.
 In logic programming we have a knowledge base which we know before and along with
the question and knowledge base which is given to machine, it produces result.
 In normal programming languages, such concept of knowledge base is not available but
while using the concept of artificial intelligence, machine learning we have some models
like Perception model which is using the same mechanism.
 In logical programming the main emphasize is on knowledge base and the problem.
 The execution of the program is very much like proof of mathematical statement, e.g.,
Prolog

7.Functional programming paradigms


 The functional programming paradigms has its roots in mathematics and it is language
independent.
 The key principal of this paradigms is the execution of series of mathematical functions.
 The central model for the abstraction is the function which are meant for some specific
computation and not the data structure.
 Data are loosely coupled to functions.
 The function hide their implementation.
 Function can be replaced with their values without changing the meaning of the program.
 Some of the languages like perl, javascript mostly uses this paradigm.

8.Database/Data driven programming approach


 This programming methodology is based on data and its movement.
 Program statements are defined by data rather than hard-coding a series of steps.
 A database program is the heart of a business information system and provides file
creation, data entry, update, query and reporting functions.
 There are several programming languages that are developed mostly for database
application.
 For example SQL.
 It is applied to streams of structured data, for filtering, transforming, aggregating (such as
computing statistics), or calling other programs.
 So it has its own wide application.
Basic Structure of a C program contains following sections,
Documentation Section
Link Section
Definition Section
Global Declaration Section
main()
{
Declaration Section
Executable part
}
Subprogram section
Function 1
Function 2
.
.
function n
- The Documentation Section consists of a set of comment lines giving the name of the program
and other details.
-The Link Section provides instructions to the compiler to link functions from the system
library. C program depends upon some header files for function definition that are used in the
program. Each header file has extension ‘.h’. The header files are included at the beginning of
the program in the C language. These files should be included using #include directive as given
below
Example:
#include
(This will find header file in standard directory)
or
#include”stdio.h”( This will find header file in Current and Standard directory)
-The Definition Section
defines all symbolic constants.

-The Global Declaration Section:


There are some variables and those variables are declared in this section that is outside of all
functions.

-main() function:
Every C program must have one main() function section. int main(void): This is the function
definition for main().Parenthesis followed to main is to tell the user again that main() is a
function. Int main(void) function return an integer.

void main(void):
This function takes no arguments and return nothing.
void main():
This function returns nothing and takes no arguments. The program contains statements that are
enclosed within the braces. The opening braces “{“ and closing braces “}”.
In these two braces main() function contains two parts,
declaration and executable part. It is user defined function.
The Opening braces sometimes called logical start and Closing braces known as logical end of
the program.

Declaration Part declares


all the variables used in the executable part. There should be at least one statement in
the executable part which contains instructions to perform certain task. The declaration and
executable part must appear between the opening and closing braces. All statements in the
declaration part should end with the semicolon.

-The Subprogram Section


contains all the user defined functions that are called in the main function.
EXAMPLE PROGRAM:
1. /*Documentation Section: program to find the area of circle*/
2. #include<stdio.h> /*link section*/
3. #include<conio.h> /*link section*/
4. #define PI 3.14 /*definition section*/
5. float area; /*global declaration section*/
6. void main()
7. {
8. float r; /*declaration part*/
9. printf("Enter the radius of the circle\n"); /*executable part starts here*/
10. scanf("%f",&r);
11. area=PI*r*r;
12. printf("Area of the circle=%f",area);
13. getch();
14. }

Data types:
 Data types in c refer to an extensive system used for declaring variables or
functions of different types.
 The type of a variable determines how much space it occupies in storage and how
the bit pattern stored is interpreted.
The types in C can be classified as follows −
Sr.No. Types & Description

1 Basic Types
They are arithmetic types and are further classified into: (a) integer types and (b)
floating-point types.

2 Enumerated types
They are again arithmetic types and they are used to define variables that can
only assign certain discrete integer values throughout the program.

3 The type void


The type specifier void indicates that no value is available.

4 Derived types
They include (a) Pointer types, (b) Array types, (c) Structure types, (d) Union
types and (e) Function types.
The array types and structure types are referred collectively as the aggregate types. The type of
a function specifies the type of the function's return value. We will see the basic types in the
following section, where as other types will be covered in the upcoming chapters.
Integer Types
The following table provides the details of standard integer types with their storage sizes and
value ranges −
Type Storage size Value range

char 1 byte -128 to 127 or 0 to 255

unsigned char 1 byte 0 to 255

signed char 1 byte -128 to 127

-32,768 to 32,767 or -2,147,483,648 to


int 2 or 4 bytes
2,147,483,647
unsigned int 2 or 4 bytes 0 to 65,535 or 0 to 4,294,967,295

short 2 bytes -32,768 to 32,767

unsigned short 2 bytes 0 to 65,535

long 4 bytes -2,147,483,648 to 2,147,483,647

unsigned long 4 bytes 0 to 4,294,967,295


To get the exact size of a type or a variable on a particular platform, you can use
the sizeof operator. The expressions sizeof(type) yields the storage size of the object or type in
bytes. Given below is an example to get the size of int type on any machine −
#include <stdio.h>
#include <limits.h>
int main() {
printf("Storage size for int : %d \n", sizeof(int));
return 0;
}
When you compile and execute the above program, it produces the following result on Linux −
Storage size for int : 4
Floating-Point Types
The following table provide the details of standard floating-point types with storage sizes and
value ranges and their precision −
Type Storage size Value range Precision

float 4 byte 1.2E-38 to 3.4E+38 6 decimal places

double 8 byte 2.3E-308 to 1.7E+308 15 decimal places

long double 10 byte 3.4E-4932 to 1.1E+4932 19 decimal places


The header file float.h defines macros that allow you to use these values and other details about
the binary representation of real numbers in your programs. The following example prints the
storage space taken by a float type and its range values −
#include <stdio.h>
#include <float.h>

int main() {
printf("Storage size for float : %d \n", sizeof(float));
printf("Minimum float positive value: %E\n", FLT_MIN );
printf("Maximum float positive value: %E\n", FLT_MAX );
printf("Precision value: %d\n", FLT_DIG );
return 0;
}
When you compile and execute the above program, it produces the following result on Linux −
Storage size for float : 4
Minimum float positive value: 1.175494E-38
Maximum float positive value: 3.402823E+38
Precision value: 6

Storage Class
A storage class defines the scope (visibility) and life-time of variables and/or functions
within a C Program. They precede the type that they modify. We have four different storage
classes in a C program −
 auto
 register
 static
 extern
The auto Storage Class
The auto storage class is the default storage class for all local variables.
{
int mount;
auto int month;
}
The example above defines two variables with in the same storage class. 'auto' can only be used
within functions, i.e., local variables.
The register Storage Class

 The register storage class is used to define local variables that should be stored in a
register instead of RAM.
 This means that the variable has a maximum size equal to the register size (usually one
word) and can't have the unary '&' operator applied to it (as it does not have a memory
location).
{
register int miles;
}
 The register should only be used for variables that require quick access such as counters.
It should also be noted that defining 'register' does not mean that the variable will be
stored in a register.
 It means that it MIGHT be stored in a register depending on hardware and
implementation restrictions.
The static Storage Class

 The static storage class instructs the compiler to keep a local variable in existence
during the life-time of the program instead of creating and destroying it each time it
comes into and goes out of scope.
 Therefore, making local variables static allows them to maintain their values between
function calls.
 The static modifier may also be applied to global variables. When this is done, it causes
that variable's scope to be restricted to the file in which it is declared.
In C programming, when static is used on a global variable, it causes only one copy of that
member to be shared by all the objects of its class.
#include <stdio.h>
/* function declaration */
void func(void);
static int count = 5; /* global variable */
main()
{
while(count--) {
func();
}

return 0;
}
/* function definition */
void func( void ) {
static int i = 5; /* local static variable */
i++;
printf("i is %d and count is %d\n", i, count);
}
When the above code is compiled and executed, it produces the following result −
i is 6 and count is 4
i is 7 and count is 3
i is 8 and count is 2
i is 9 and count is 1
i is 10 and count is 0
The extern Storage Class

 The extern storage class is used to give a reference of a global variable that is visible to
ALL the program files.
 When you use 'extern', the variable cannot be initialized however, it points the variable
name at a storage location that has been previously defined.
 When you have multiple files and you define a global variable or function, which will
also be used in other files, then extern will be used in another file to provide the
reference of defined variable or function.
 Just for understanding, extern is used to declare a global variable or function in another
file.
The extern modifier is most commonly used when there are two or more files sharing the same
global variables or functions as explained below.
First File: main.c
#include <stdio.h>
int count ;
extern void write_extern();
main()
{
count = 5;
write_extern();
}
Second File: support.c
#include <stdio.h>

extern int count;


void write_extern(void) {
printf("count is %d\n", count);
}
Here, extern is being used to declare count in the second file, where as it has its definition in the
first file, main.c. Now, compile these two files as follows −
$gcc main.c support.c
It will produce the executable program a.out. When this program is executed, it produces the
following result −
count is 5

Variables

 In programming, a variable is a container (storage area) to hold data.


 To indicate the storage area, each variable should be given a unique name (identifier).
Variable names are just the symbolic representation of a memory location. For example:

int playerScore = 95;

Here, playerScore is a variable of integer type. Here, the variable is assigned an integer value 95.
The value of a variable can be changed, hence the name variable.

char ch = 'a';
// some code
ch = 'l';
Rules for naming a variable
1. A variable name can have letters (both uppercase and lowercase letters), digits and
underscore only.
2. The first letter of a variable should be either a letter or an underscore.
3. There is no rule on how long a variable name (identifier) can be. However, you may run
into problems in some compilers if variable name is longer than 31 characters.
Note: You should always try to give meaningful names to variables. For example: firstNameis a
better variable name than fn.
C is a strongly typed language. This means, variable type cannot be changed once it is declared.
For example:

int number = 5; // integer variable


number = 5.5; // error
double number; // error

Constants/Literals
A constant is a value (or an identifier) whose value cannot be altered in a program. For
example: 1, 2.5, 'c' etc.
Here, 1, 2.5 and 'c'are literal constants. Why? You cannot assign different values to these terms.
You can also create non-modifiable variables in C programming. For example:

const double PI = 3.14;

Notice, we have added keyword const.


Here, PI is a symbolic constant. It's actually a variable however, it's value cannot be changed.

const double PI = 3.14;


PI = 2.9; //Error

Below are the different types of constants you can use in C.

1. Integers
An integer is a numeric constant (associated with number) without any fractional or exponential
part. There are three types of integer constants in C programming:
 decimal constant(base 10)
 octal constant(base 8)
 hexadecimal constant(base 16)
For example:

Decimal constants: 0, -9, 22 etc


Octal constants: 021, 077, 033 etc
Hexadecimal constants: 0x7f, 0x2a, 0x521 etc

In C programming, octal starts with a 0, and hexadecimal starts with a 0x.


2. Floating-point constants
A floating point constant is a numeric constant that has either a fractional form or an exponent
form. For example:

-2.0
0.0000234
-0.22E-5

Note: E-5 = 10-5

3. Character constants
A character constant is created by enclosing a single character inside single quotation marks. For
example: 'a', 'm', 'F', '2', '}' etc;

4. Escape Sequences
Sometimes, it is necessary to use characters which cannot be typed or has special meaning in C
programming. For example: newline(enter), tab, question mark etc. In order to use these
characters, escape sequence is used.
For example: \n is used for newline. The backslash \ causes escape from the normal way the
characters are handled by the compiler.

Escape Sequences

Escape Sequences Character

\b Backspace

\f Form feed

\n Newline

\r Return

\t Horizontal tab

\v Vertical tab

\\ Backslash

\' Single quotation mark

\" Double quotation mark


Escape Sequences

Escape Sequences Character

\? Question mark

\0 Null character

5. String Literals
A string literal is a sequence of characters enclosed in double-quote marks. For example:

"good" //string constant


"" //null string constant
" " //string constant of six white space
"x" //string constant having single character.
"Earth is round\n" //prints string with newline

6. Enumerations
Keyword enum is used to define enumeration types. For example:

enum color {yellow, green, black, white};

Here, color is a variable and yellow, green, black and white are the enumeration constants having
value 0, 1, 2 and 3 respectively.

Character set
Character set is a set of alphabets, letters and some special characters that are valid in C
language.
Alphabets
Uppercase: A B C ................................... X Y Z
Lowercase: a b c ...................................... x y z
C accepts both lowercase and uppercase alphabets as variables and functions.
Digits
0123456789
Special Characters
Special Characters in C Programming

, < > . _

( ) ; $ :
% [ ] # ?

' & { } "

^ ! * / |

- \ ~ +
White space Characters
blank space, new line, horizontal tab, carriage return and form feed
Keywords
Keywords are predefined, reserved words used in programming that have special meanings to the
compiler. Keywords are part of the syntax and they cannot be used as an identifier. For example:

int money;

Here, int is a keyword that indicates 'money' is a variable of type integer.


keywords allowed in ANSI C.
Keywords in C Language

auto double int struct

break else long switch

case enum register typedef

char extern return union

continue for signed void

do if static while

default goto sizeof volatile

const float short unsigned


Identifiers

 Identifier refers to name given to entities such as variables, functions, structures etc.
Identifier must be unique.
They are created to give unique name to a entity to identify it during the execution of the
program. For example:

int money;
double accountBalance;

Here, money and accountBalance are identifiers.


Also remember, identifier names must be different from keywords. You cannot use int as an
identifier because int is a keyword.
Rules for naming identifiers
1. A valid identifier can have letters (both uppercase and lowercase letters), digits and
underscores.
2. The first letter of an identifier should be either a letter or an underscore.
3. There is no rule on how long an identifier can be. However, you may run into problems in
some compilers if identifier is longer than 31 characters.
4.
Operators
An operator is a symbol which operates on a value or a variable. For example: + is an
operator to perform addition.
C has wide range of operators to perform various operations.
C Arithmetic Operators
An arithmetic operator performs mathematical operations such as addition, subtraction and
multiplication on numerical values (constants and variables).

Operato
Meaning of Operator
r

+ addition or unary plus

- subtraction or unary minus

* multiplication

/ division

% remainder after division( modulo division)

Example 1: Arithmetic Operators

// C Program to demonstrate the working of arithmetic operators


#include <stdio.h>
int main()
{
int a = 9,b = 4, c;
c = a+b;
printf("a+b = %d \n",c);
c = a-b;
printf("a-b = %d \n",c);
c = a*b;
printf("a*b = %d \n",c);
c=a/b;
printf("a/b = %d \n",c);
c=a%b;
printf("Remainder when a divided by b = %d \n",c);
return 0;
}
Output

a+b = 13
a-b = 5
a*b = 36
a/b = 2
Remainder when a divided by b=1

Increment and decrement operators


C programming has two operators increment ++ and decrement -- to change the value of an
operand (constant or variable) by 1.
Increment ++ increases the value by 1 whereas decrement -- decreases the value by 1. These two
operators are unary operators, meaning they only operate on a single operand.
Example 2: Increment and Decrement Operators

// C Program to demonstrate the working of increment and decrement operators


#include <stdio.h>
int main()
{
int a = 10, b = 100;
float c = 10.5, d = 100.5;
printf("++a = %d \n", ++a);
printf("--b = %d \n", --b);
printf("++c = %f \n", ++c);
printf("--d = %f \n", --d);
return 0;
}
Output

++a = 11
--b = 99
++c = 11.500000
++d = 99.500000
C Assignment Operators
An assignment operator is used for assigning a value to a variable. The most common
assignment operator is =

Operator Example Same as

= a=b a=b

+= a += b a = a+b

-= a -= b a = a-b

*= a *= b a = a*b

/= a /= b a = a/b

%= a %= b a = a%b
Example 3: Assignment Operators

// C Program to demonstrate the working of assignment operators


#include <stdio.h>
int main()
{
int a = 5, c;

c = a;
printf("c = %d \n", c);

c += a; // c = c+a
printf("c = %d \n", c);

c -= a; // c = c-a
printf("c = %d \n", c);

c *= a; // c = c*a
printf("c = %d \n", c);

c /= a; // c = c/a
printf("c = %d \n", c);

c %= a; // c = c%a
printf("c = %d \n", c);

return 0;
}
Output

c=5
c = 10
c=5
c = 25
c=5
c=0

C Relational Operators
A relational operator checks the relationship between two operands. If the relation is true, it
returns 1; if the relation is false, it returns value 0.
Relational operators are used in decision making and loops.

Operator Meaning of Operator Example

== Equal to 5 == 3 returns 0

> Greater than 5 > 3 returns 1

< Less than 5 < 3 returns 0

!= Not equal to 5 != 3 returns 1

>= Greater than or equal to 5 >= 3 returns 1

<= Less than or equal to 5 <= 3 return 0


Example 4: Relational Operators

// C Program to demonstrate the working of arithmetic operators


#include <stdio.h>
int main()
{
int a = 5, b = 5, c = 10;

printf("%d == %d = %d \n", a, b, a == b); // true


printf("%d == %d = %d \n", a, c, a == c); // false

printf("%d > %d = %d \n", a, b, a > b); //false


printf("%d > %d = %d \n", a, c, a > c); //false

printf("%d < %d = %d \n", a, b, a < b); //false


printf("%d < %d = %d \n", a, c, a < c); //true
printf("%d != %d = %d \n", a, b, a != b); //false
printf("%d != %d = %d \n", a, c, a != c); //true

printf("%d >= %d = %d \n", a, b, a >= b); //true


printf("%d >= %d = %d \n", a, c, a >= c); //false

printf("%d <= %d = %d \n", a, b, a <= b); //true


printf("%d <= %d = %d \n", a, c, a <= c); //true

return 0;

}
Output

5 == 5 = 1
5 == 10 = 0
5>5=0
5 > 10 = 0
5<5=0
5 < 10 = 1
5 != 5 = 0
5 != 10 = 1
5 >= 5 = 1
5 >= 10 = 0
5 <= 5 = 1
5 <= 10 = 1

C Logical Operators
An expression containing logical operator returns either 0 or 1 depending upon whether
expression results true or false. Logical operators are commonly used in decision making in C
programming.

Operator Meaning of Operator Example

Logial AND. True only if all If c = 5 and d = 2 then, expression ((c == 5)


&&
operands are true && (d > 5)) equals to 0.

Logical OR. True only if either If c = 5 and d = 2 then, expression ((c == 5) || (d


||
one operand is true > 5)) equals to 1.
Operator Meaning of Operator Example

Logical NOT. True only if the


! If c = 5 then, expression ! (c == 5) equals to 0.
operand is 0
Example #5: Logical Operators

// C Program to demonstrate the working of logical operators

#include <stdio.h>
int main()
{
int a = 5, b = 5, c = 10, result;

result = (a == b) && (c > b);


printf("(a == b) && (c > b) equals to %d \n", result);

result = (a == b) && (c < b);


printf("(a == b) && (c < b) equals to %d \n", result);

result = (a == b) || (c < b);


printf("(a == b) || (c < b) equals to %d \n", result);

result = (a != b) || (c < b);


printf("(a != b) || (c < b) equals to %d \n", result);

result = !(a != b);


printf("!(a == b) equals to %d \n", result);

result = !(a == b);


printf("!(a == b) equals to %d \n", result);

return 0;
}
Output

(a == b) && (c > b) equals to 1


(a == b) && (c < b) equals to 0
(a == b) || (c < b) equals to 1
(a != b) || (c < b) equals to 0
!(a != b) equals to 1
!(a == b) equals to 0

Explanation of logical operator program


 (a == b) && (c > 5) evaluates to 1 because both operands (a == b) and (c > b) is 1 (true).
 (a == b) && (c < b) evaluates to 0 because operand (c < b) is 0 (false).
 (a == b) || (c < b) evaluates to 1 because (a = b) is 1 (true).
 (a != b) || (c < b) evaluates to 0 because both operand (a != b) and (c < b) are 0 (false).
 !(a != b) evaluates to 1 because operand (a != b) is 0 (false). Hence, !(a != b) is 1 (true).
 !(a == b) evaluates to 0 because (a == b) is 1 (true). Hence, !(a == b) is 0 (false).

Bitwise Operators
During computation, mathematical operations like: addition, subtraction, addition and division
are converted to bit-level which makes processing faster and saves power.
Bitwise operators are used in C programming to perform bit-level operations.

Operators Meaning of operators

& Bitwise AND

| Bitwise OR

^ Bitwise exclusive OR

~ Bitwise complement

<< Shift left

>> Shift right


Comma Operator
Comma operators are used to link related expressions together. For example:

int a, c = 5, d;

The sizeof operator


The sizeof is an unary operator which returns the size of data (constant, variables, array, structure
etc).
Example 6: sizeof Operator

#include <stdio.h>
int main()
{
int a, e[10];
float b;
double c;
char d;
printf("Size of int=%lu bytes\n",sizeof(a));
printf("Size of float=%lu bytes\n",sizeof(b));
printf("Size of double=%lu bytes\n",sizeof(c));
printf("Size of char=%lu byte\n",sizeof(d));
printf("Size of integer type array having 10 elements = %lu bytes\n", sizeof(e));
return 0;
}
Output

Size of int = 4 bytes


Size of float = 4 bytes
Size of double = 8 bytes
Size of char = 1 byte
Size of integer type array having 10 elements = 40 bytes

C Ternary Operator (?:)


Ternary operator is a conditional operator that works on 3 operands.
Conditional Operator Syntax

conditionalExpression ? expression1 : expression2;

The conditional operator works as follows:


 The first expression conditionalExpression is evaluated first. This expression evaluates to
1 if it's true and evaluates to 0 if it's false.
 If conditionalExpression is true, expression1 is evaluated.
 If conditionalExpression is false, expression2 is evaluated.
Example 7: C conditional Operator

#include <stdio.h>
int main(){
char February;
int days;
printf("If this year is leap year, enter 1. If not enter any integer: ");
scanf("%c",&February);

// If test condition (February == 'l') is true, days equal to 29.


// If test condition (February =='l') is false, days equal to 28.
days = (February == '1') ? 29 : 28;

printf("Number of days in February = %d",days);


return 0;
}
Output

If this year is leap year, enter 1. If not enter any integer: 1


Number of days in February = 29
Operator Precedence :
Category Operator Associativity

Postfix () [] -> . ++ - - Left to right

Unary + - ! ~ ++ - - (type)* & sizeof Right to left

Multiplicative */% Left to right

Additive +- Left to right

Shift << >> Left to right

Relational < <= > >= Left to right

Equality == != Left to right

Bitwise AND & Left to right

Bitwise XOR ^ Left to right

Bitwise OR | Left to right

Logical AND && Left to right

Logical OR || Left to right

Conditional ?: Right to left

Assignment = += -= *= /= %=>>= <<= &= ^= |= Right to left

Comma , Left to right

Potrebbero piacerti anche