Monday, 15 June 2020

Single Link List

What is single link list


Link list is a dynamic data structure which occupies memory as required no memory wasted in contrast to Array. Data storage unit in list is called node as given below.


In link list node is created and dynamic space allocated while storing data. Next pointer point the next element of list you can add, delete data at any position of list. A start node points the first element of list.



One disadvantage of using arrays to store data is that arrays are static structures and therefore cannot be easily extended or reduced to fit the data set. Arrays are also expensive to maintain new insertions and deletions. In this chapter we consider another data structure called Linked Lists that addresses some of the limitations of arrays.




Sunday, 14 June 2020

Swap variable value without using temporary variable

Q : Write a C program to swap the values of two variables without using the temporary variable?

Answer :

#include<stdio.h>
#include<conio.h>
/*##########################
     Girfa Student Help
     Swap two variable without
     temporary variable
  ##########################*/

Friday, 12 June 2020

Count divisible number in given range C Language

Q : Write a C Program to print and count all numbers between 1 to 100 divisible by 11.


Answer : 



#include<stdio.h>
#include<conio.h>
/*##########################
     Girfa Student Help
     Count & print all number 1 to 100
     divisible by 11
  ##########################*/

Actual and former parameter C Language


As we know C language is building block of function. Anything done in C language by function. Function can take argument. There are two types of argument given below.

  • Argument pass while calling is actual
  • Argument while declaring function is former


#include<stdio.h>
#include<conio.h>
/*##########################
     Girfa Student Help
     Formal and actual parameter program
  ##########################*/
int sum(int,int);
void main()
{
     int a,b,c;
     clrscr();
     a=10;
     b=20;
     c=sum(a,b);   /* a and b are actual parameter */
     printf("\n\tA=%d\n\tB=%d\n\tSum=%d",a,b,c);
     getch();
}
int sum(n1,n2) /* n1,n2 are formal parameter */
{
     return n1+n2;
}

In the function main in the example above, a, and b are all actual parameters when used to call calculate sum function. On the other hand, the corresponding variables in sum_funcation definition (namely n1, n2) are all formal parameters because they appear in a function definition.