Saturday, 27 January 2018

Disadvantage of nested if-else

Disadvantage of nested if-else


  • When number of criteria increase complexity of maintenance of code is also increased
  • If indenting is not proper maintained then it is difficult to debugging because a programmer faces difficulty associate statement to related block.
  •  Else-if leader does not specify better interpretation of business logic to programmer than switch case.

Thursday, 25 January 2018

2D Array Input/Ouput

Q :  Define a two dimensional array ‘int a[10][10]’. Write a ‘C’ program to initialize this array with numbers between 0 and 99. Then print the contents of ‘a’.

Solution : 

/*==============================
     Girfa Student Help
     Program : 2D Array Input/Ouput
     More Program :http://girfahelp.blogspot.in/p/2-d-array-programming.html
================================*/
#include<stdio.h>
#include<conio.h>
#define MAX 10
void main()
{
     int a[MAX][MAX],r,c,s;
     clrscr();
     for(r=0,s=

Tuesday, 23 January 2018

2-D array sum using function

Q: Write a ‘C’ function to calculate matrix C such that C=A+B Use suitable loops. Make use of pointers if necessary

Solution : 

/*==============================
     Girfa Student Help
     Program : 2-D array sum using function
     More Program :http://girfahelp.blogspot.in/p/2-d-array-programming.html
================================*/

#include<stdio.h>
#include<conio.h>
#define MAX 3
void add(int [][MAX],int [][MAX],int [][MAX]);
void print(int [][MAX]);
void main()
{
     int a1[MAX][MAX],a2[MAX][MAX],a3[MAX][MAX],r,c;
     clrscr();
     printf("\nFirst Array Input\n");
     for(r=0;r<MAX;r++)

Sunday, 21 January 2018

Significance of header file



To understand significance of header file. I would like to ask you a question. Why do we choose high level language to develop software instead of low level language?

Answer is we choose high level language like C language  to develop software. Because there are lots of things that can be achieved by only calling some function provided by related language compiler. One the other hand in low level language every things of programming is manually done by programmer. For example if you want to generate output on screen using assembly language you will have to set many register value which is very complicated. Whereas in C language you will have to use inbuilt function printf.