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............. 

Types of conversion

                           C programming

Types of conversion:

  • implicit conversion
  • explicit conversion

Implicit conversion:

Implicit conversion is done by the compiler according to some predefined rules this is also called as automatic conversion.It implicit conversion aperants of lower type are automatically converted to higher types.
for ex: int is automatically converted to float. 
A predefined heirarchy is used.

Explicit conversion:

Is done when higher type converted into lower type this kind of conversion can not perform by the compiler hence done explicitly.
syntax- (type)value
Ex-#include<stdio.h>
main()
{
double a=5.2,b=2.3;
int c;
c=(int)(a/b);
printf("%d",c);
}
List, here if you go down you have to use explicit conversion and if you come up in list you have to use implicit conversion.
  • long double
  • double
  • float
  • unsigned long int
  • long int
  • unsigned int
  • int 
  • short int, char
here i discribe about implicit and explicit conversion i hope you understand.
Thank you,
if you any doubt lease 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