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

Function Part 1

Hello, today we will learn about function in c programming...............

Function:

Function is self content block of code that performs a particular task. Most of the computer programs that solves much bigger and complex. Every C program can be thought as a collection of these functions. They interact with each other to accomplish a particular task function follows following approach. This approach of problem solving is called as conquer and divide strategy.

Types of function:

  1. Function prototype /declaration
  2. Function definition
  3. Function call  
Function prototype:

Syntax:
   return type  function name  (parameter list)
Ex.
int sum (int a, int b)
float mul (int, float, int)

Function prototype consist of three part-
  • return type
  • type of parameter
  • no. of parameter

Function call:

Function call by simply using function name following by a list of parameter.
Syntax:
function name (parameter list)

Function definition:

Function prototype consist of two parts functions header and function body.
return type    function name (datatype para1, ........,datatype para n)
{
body of function
}



First of all as I say that there are three part of function mean we have to follow three time rule mean first after include the header file we have to create  a function in this.
In function prototype according to syntax we write return type then  after we give name to that function and then we write variable name as parameter list in ( ) this bracket .
We use function call when we need any time that function in our program,

then we reach at function definition every important work is done here mean programming , this is also use as main function , we take input in main function and calculate in function definition then by return keyword we pass this to main function


Thank you,
if any related problem this post please comment below.
keep supporting.................... 

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