Friday, 12 June 2020

Difference between function definition and function declaration

Difference between  function definition and function declaration

DECLARATION
DEFINITION
A variable or a function can be declared any number of times
A variable or a function can be defined only once
Memory will not be allocated during declaration
Memory will be allocated
int f(int);
The above is a function declaration. This declaration is just for informing the compiler that a function named f with return type and argument as int will be used in the function.
int f(int a)
{
  return a;
}
The system allocates memory by seeing the above function definition.

Decimal to Binary conversion C language

Q : Write a C Program using function to print equivalent binary number of decimal number input by keyboard ?

Answer : 

#include<stdio.h>
#include<conio.h>
/*##########################
     Girfa Student Help
     Decimal to Binary conversion
  ##########################*/
void main()
{
     int d,b,ar[10],i;
     clrscr();
     printf("Enter number> ");
     scanf("%d",&d);
     i=0;
     while(d>0)
     {
          ar[i]=d%2;
          d=d/2;
          i++;
     }
     i--;
     while(i>=0)
     {
          printf("\t%d",ar[i]);
          i--;
     }
     getch();
}

Thursday, 11 June 2020

Second Highest number from array using C language

Q : find second largest number from 1D array of n numbers.


Answer : 


#include<stdio.h>
void main()
{
     int n1,n2,ar[5],i;

Tuesday, 9 June 2020

Answer :July 2019 Introduction to ICT Resources

Answer : NIELIT (O-Level) July 2019  Introduction to ICT Resources

1. Multiple Choice


1.1 : B
1.2 : A
1.3 : C
1.4 : D
1.5 : C
1.6 : A
1.7 : A
1.8 : B
1.9 : C
1.10 : C