See a problem in else if statement

Dangling else problem

Image
Hello, This problem comes when we use else if statement and do some mistake more describe is given below......... Dangling else problem: One of the major problem with nested if is dangling else problem. The problem arises when both outer if statement inner if statement might pair with common else statement. Thus the compiler is not able to judge to pair the else with which statement. The solution to this problem is given by the compiler that it pairs else with the recent if thus sometimes giving wrong result.                                           Hence the programmer should put early bracket wherever required. This post is may very short because my only aim was to describe this problem. Thank you, Keep supporting............. 

Introduction to C part-3

                                   C programming

Operator:

An operator is a symbol that specifies the mathematical, logical or realation operation to be performed. C language supports different type off operators which is used with the variables.

Operators in C:

  • Arithmetic 
  • Relational
  • Equality
  • Logical 
  • Unary
  • Conditional 
  •  Bitwise
  • Assignment 
  • Comma
  • Size of operator

Arithmetic operator:

Arithmetic operators take numerical values (either literals or variables) as their operands and return a single numerical value. The standard arithmetic operators are addition (+), subtraction (-), multiplication (*), and division (/).

Relational operator:

Relational operator is also known as comparison operator. This operator compares two values. Relational operator returns a true or false value.
Ex.- < , >, <= , >= .

Equality Operator:

C language supports two kind of equality operators.

  • equal ( = )
  • not equal (! = )
Comparison Operators: 
  • Greater than (>)
  • equal to (==)
  • Less than  (<)
  • Greater than or equal than to   (>=)
  • Less than or equal to   (<=)

Logical operator:

C language supports three logical operator -- logical AND( && ) ,logical OR (::) ,logical NOT ( ! ).

Logical AND:

Input         output
  X    Y        Z
 0      0        0
 0      1        0
 1      0       0
 1      1       1

Logical OR:


Input         output
  X    Y        Z
 0      0        0
 0      1        1
 1      0        1
 1      1        1

Logical NOT:


  p   0    1

~p   1     0

Unary operator:


Unary operator act on single operands.C languaeg supports three unary operators : unary minus , increment and decrement operator.

Conditional operator:

In conditional operator only one sign ( ?: )this is use in situation place.

Assignment operator:

in C this is use or assign any value in variable. and sign is ( = )
here value assign from right variable to left variable, left side variable store that value.
ex- a=b
here value of b will store in a.and b will be empty.



Thank  you,
now here intro of C language is complete these are some basic information of C, and after remember you will continue your C.
If i forget anything or you want more explain on any point please comment below.

Comments

Popular posts from this blog

Libraray Fine Hackerrank solution in C || Balanced Brackets Hackerrank solution in C

Permutations of Strings hackerrank solution in C || Permutations of Strings

Introduction to C part 2