Skip to main content

C  Functions :


Introduction to C Functions

เค•เคˆ เคฌाเคฐ เค†เคชเค•े program เคฎें เค•ुเค› เคเคธे statements เคนो เคธเค•เคคे เคนै เคœिเคจ्เคนें เค†เคชเค•ो compiler เคธे เคฌाเคฐ เคฌाเคฐ execute เค•เคฐเคตाเคจे เค•ी เค†เคตเคถ्เคฏเค•เคคा เคนोเคคी เคนै। เคเคธी situation เคฎें เค‡เคจ statements เค•ो เคฌाเคฐ เคฌाเคฐ เคฒिเค–เคจे เคฎें เคฌเคนुเคค เคธเคฎเคฏ เคฒเค— เคธเค•เคคा เคนै। เคธाเคฅ เคนी เค‡เคธเคธे program เคฌเคนुเคค เคฌเฅœा เคนो เคœाเคคा เคนै เคœिเคธเคธे เค‰เคธे เคชเฅเคจे เค”เคฐ เคธเคฎเคเคจे เคฎें เคฎुเคถ्เค•िเคฒ เคนोเคคी เคนै। 
เค‡เคธ situation เคธे เคฌเคšเคจे เค•े เคฒिเค C เค†เคชเค•ो เคเค• mechanism provide เค•เคฐเคคी เคนै เคœिเคธे function เค•เคนเคคे เคนै। เคœिเคจ เคญी statements เค•ो เค†เคช program เคฎें เค•เคˆ เคœเค—เคน เคฌाเคฐ เคฌाเคฐ execute เค•เคฐเคตाเคจा เคšाเคนเคคे เคนै เค‰เคจ्เคนें เคเค• block เคฎें เคฒिเค–เคคे เคนै เค”เคฐ เค‡เคธ block เค•ो เคเค• unique เคจाเคฎ เคฆेเคคे เคนै।
เค‡เคธเค•े เคฌाเคฆ program เคฎें เคœँเคนा เคญी เคœिเคคเคจी เคญी เคฌाเคฐ เค‡เคจ statements เค•ो เค†เคช execute เค•เคฐเคตाเคจा เคšाเคนเคคे เคนै เคคเคฌ เค†เคช function เค•े เค‰เคธ unique เคจाเคฎ เค•े เคฆ्เคตाเคฐा เค‰เคธ function เค•ो call เค•เคฐเคคे เคนै। Call เค•เคฐเคคे เคนी function (block) เคฎें เคฒिเค–े เค—เค เคธเคญी statements execute เคนो เคœाเคคे เคนै।   
Function เค•ा name เค”เคฐ parameters (เค‡เคจเค•े เคฌाเคฐे เคฎें เค†เคช เค†เค—े เคชเคข़ेंเค—े) เคœเคฌ เค†เคช เคฒिเค–เคคे เคนै เคคो เค‰เคธे function declaration เค•เคนा เคœाเคคा เคนै। เคœเคฌ เค†เคช function เคฎें execute เคนोเคจे เคตाเคฒे เคธเคญी statements เคฒिเค–เคคे เคนै เคคो เค‰เคธे function definition เค•เคนा เคœाเคคा เคนै। เคœเคฌ เค†เคช เคชूเคฐे program เคฎें เค•ँเคนी เคญी function เค•ो use เค•เคฐเคคे เคนै เคคो เค‰เคธे function call เค•เคนा เคœाเคคा เคนै।
เค•िเคธी เคญी program เคฎें functions เค•ो use เค•เคฐเคจे เค•ी advantages เคจीเคšे เคฆी เคœा เคฐเคนी เคนै।
  1. Functions create เค•เคฐเคจे เคธे programmer เค•ा time เค”เคฐ computer เค•ी memory เคฌเคšเคคी เคนै। 
  2. เคเค• เคนी code เค•ो เค†เคธाเคจी เคธे เคฌाเคฐ เคฌाเคฐ use เค•िเคฏा เคœा เคธเค•เคคा เคนै। เค‡เคธเคธे code re-usability เคฌเคข़เคคी เคนै।
  3. Program modules เคฎें divide เคนो เคœाเคคा เคนै เคœिเคธเคธे เค‰เคธे เค†เคธाเคจी เคธे manage เค”เคฐ debug เค•िเคฏा เคœा เคธเค•เคคा เคนै। 
  4. Program เค•ी readability เคฌเคข़เคคी เคนै। 

C language เคฎें เคฆो เคช्เคฐเค•ाเคฐ เค•े functions เคนोเคคे เคนै।
  • Predefined Functions 
  • User-defined Functions

PREDEFINED FUNCTIONS   

Predefined functions or Built in function เคตो functions เคนोเคคे เคนै เคœो C library เคฎें เคชเคนเคฒे เคธे เคนी provide เค•िเคฏे เค—เค เคนै। เค‡เคจ function เค•ो เคชเคนเคฒे เคธे เคนी declare เค”เคฐ define เค•िเคฏा เค—เคฏा เคนोเคคा เคนै। เคฌเคธ เค‡เคจ्เคนें use เค•เคฐเคจे เค•े เคฒिเค header files เค•ो include เค•เคฐเคจा เคนोเคคा เคนै
เค‰เคฆाเคนเคฐเคฃ เค•े เคฒिเค เคฏเคฆि เค†เคช เค…เคชเคจे program เคฎें scanf() เค”เคฐ printf() เคœैเคธे functions use เค•เคฐเคจा เคšाเคนเคคे เคนै เคคो เค‡เคธเค•े เคฒिเค เค†เคช <stdio> header file เค•ो เค…เคชเคจे program เคฎें include เค•เคฐเคคे เคนै। เคฏे เคฆोเคจों เคนी predefined functions เคนै।
Predefined functions เค•े เค•ुเค› เค‰เคฆाเคนเคฐเคฃ –
  • scanf() 
  • printf()
  • strcpy()
  • void *malloc()
  • int to lower() เค†เคฆि เคนै।  

USER DEFINED FUNCTIONS  

User defined functions เคตो function เคนोเคคे เคนै เคœो programmer (เค†เคช) เค–ुเคฆ create เค•เคฐเคคे เคนै। Programmer เค…เคชเคจी เค†เคตเคถ्เคฏเค•เคคा เค•े เค…เคจुเคธाเคฐ เค•िเคคเคจे เคญी functions create เค•เคฐ เคธเค•เคคा เคนै। เคฏे functions เค•ैเคธे create เค•िเคฏे เคœाเคคे เคนै เค”เคฐ เค‡เคจ्เคนें เค•ैเคธे use เค•िเคฏा เคœाเคคा เคนै। 
      

Creating and Using C Functions

C เคฎें functions create เค•เคฐเคจा เค”เคฐ เค‰เคจ्เคนें use เค•เคฐเคจा เคฌเคนुเคค เคนी เค†เคธाเคจ เคนै। เค‡เคธ process เค•े 3 เคฎुเค–्เคฏ steps เคนोเคคे เคนै।
  1. Functions Declaration
  2. Function Definition 
  3. Function Call

FUNCTION DECLARATION

เค‡เคธ part เคฎें เค†เคช function เค•ा เคจाเคฎ, เค‰เคธเค•ा return type เค”เคฐ parameters define เค•เคฐเคคे เคนै। Function declaration เค•ा general syntax เคจीเคšे เคฆिเคฏा เค—เคฏा เคนै। 
<return-type> <function-name>(<list-of-parameters>);
  • return-type  –  เค†เคชเค•ा function execution complete เคนोเคจे เคชเคฐ เค•िเคธ เคช्เคฐเค•ाเคฐ เค•ी value return เค•เคฐेเค—ा เคฏे เค†เคช return type เค•े เคฆ्เคตाเคฐा define เค•เคฐเคคे เคนै। เคฏเคฆि เค†เคช เคเค• addition เค•ा program เคฌเคจा เคฐเคนे เคนै เคœो 2 whole numbers เค•ो add เค•เคฐเคคा เคนै เคคो เค†เคชเค•ा return type int เคนोเค—ा। 
  • function-name  –  เคฏे เค†เคชเค•े function เค•ा เคจाเคฎ เคนोเคคा เคนै। เคฏे เคชूเคฐे program เคฎें unique เคนोเคจा เคšाเคนिเค। เคœเคฌ เค†เคช function เค•ो call เค•เคฐเคคे เคนै เคคो เค‡เคธ เคจाเคฎ เค•ो เคนी เคฒिเค–เคคे เคนै। 
  • list-of-parameters  –  เคฏे เค‰เคจ variables เค•ी list เคนोเคคी เคนै เคœो เค†เคช function เค•ो call เค•เคฐเคคे เคธเคฎเคฏ เคชाเคธ เค•เคฐेंเค—े। เคœैเคธे เค•ी เคฏเคฆि เค†เคช addition เค•ा function เคฌเคจा เคฐเคนे เคนै เคคो parameters เค•े เคฐूเคช เคฎें เค†เคช 2 numbers เคฏा 2 variables เคชाเคธ เค•เคฐ เคธเค•เคคे เคนै เค”เคฐ เคซिเคฐ function เค•े เค…ंเคฆเคฐ เค‰เคจเค•ो add เค•เคฐเค•े result show เค•เคฐ เคธเค•เคคे เคนै। เคฏเคน เค†เคตเคถ्เคฏเค• เคจเคนीं เค•ी เค†เคช เคธเคญी functions เคฎें parameters define เค•เคฐें।   
        
เคเค• เคฌाเคค เค†เคชเค•ो เคนเคฎेเคถा เคฏाเคฆ เคฐเค–เคจी เคšाเคนिเค เค•ी function declaration statement เค•ो เค†เคช semicolon เคธे terminate เค•เคฐเคคे เคนै। เคฒेเค•िเคจ function definition เค•े เคธाเคฅ เคเคธा เคจเคนीं เคนोเคคा เคนै। เคฎाเคจ เคฒीเคœिเคฏे เค•ी เค†เคช addition เค•ा function เคฌเคจा เคฐเคนे เคนै เคœो เคฆो numbers เค•ो add เค•เคฐเคคा เคนै เคคो เค‰เคธे เค†เคช เค‡เคธ เคช्เคฐเค•ाเคฐ declare เค•เคฐเคคे เคนै।
/* A function declaration with two parameters */
int add(int a, int b);  
   

FUNCTION DEFINITION  

เค‡เคธ part เค•ो function body เคญी เค•เคนा เคœाเคคा เคนै। เค‡เคธเคฎें เค†เคช เคตो statements เคฒिเค–เคคे เคนै เคœिเคจ्เคนें เค†เคช execute เค•เคฐเคตाเคจा เคšाเคนเคคे เคนै।
<return-type> <function-name>(<list-of-parameters>)
{
      statement 1;
      statement 2;
       .
       .
      statement N; 
  
}
   
Function definition เคฎें return-type, function-name เค”เคฐ list-of-parameters เค‰เคธी เคช्เคฐเค•ाเคฐ เคนोเคคे เคนै เคœैเคธे เค•ी function declaration เคฎें เคนोเคคे เคนै। เค‡เคจเค•े เคฌाเคฆ เคฎें curly brackets เค•े block เคฎें เคตो statements เคฒिเค–े เคœाเคคे เคนै เคœो เค†เคช execute เค•เคฐเคตाเคจा เคšाเคนเคคे เคนै।
เคฏเคฆि เค†เคช addition เค•े function เค•ी เคฌाเคค เค•เคฐे เคคो เค‰เคธเค•ी definition เค†เคช เค‡เคธ เคช्เคฐเค•ाเคฐ เคฒिเค– เคธเค•เคคे เคนै।
/* Definition of add function */
int add(int a, int b)
{
    /* Statements to be executed when add function is called */
    int c;
    c = a+b;
   
    return c;
    
}
    

FUNCTION CALL

Program เคฎें เคœเคฌ เคญी เค†เคช function เค•ो use เค•เคฐเคจा เคšाเคนเคคे เคนै เคคो เค‰เคธे call เค•เคฐเคคे เคนै। 
<function-name>(<arguments-list>); 
argument-list –  arguments เคตो real values เคนोเคคी เคนै เคœो เค†เคช functions เค•ो call เค•เคฐเคคे เคธเคฎเคฏ เคชाเคธ เค•เคฐเคคे เคนै। เคฏे values function definition เคฎें parameters เค•ो assign เคนोเคคी เคนै। เค‡เคธเค•े เคฌाเคฆ เค‡เคจ values เคชเคฐ processing เคนोเคคी เคนै เค”เคฐ result return เค•िเคฏा เคœाเคคा เคนै।
Addition เค•े function เค•ो call เค•เคฐเคคे เคธเคฎเคฏ เค•ोเคˆ 2 values เคชाเคธ เค•เคฐेंเค—े เคœैเคธे เค•ी 2 เค”เคฐ 7, เค‡เคจเค•ी เคœเค—เคน variables เคญी pass เค•िเคฏे เคœा เคธเค•เคคे เคนै เคœिเคจเคฎें values store เค•ी เค—เคฏी เคนै।
เคฏे values parameter variables a เค”เคฐ b เค•ो assign เคนो เคœाเคँเค—ी เค”เคฐ function เค•े เค…ंเคฆเคฐ เค‡เคจ variables เคชเคฐ เคนी processing เคนोเคคी เคนै। เคเคธे functions เคœिเคจเคฎें parameters defined เค•िเคฏे เค—เค เคนै เค”เคฐ เคฏเคฆि เค†เคช function call เค•เคฐเคคे เคธเคฎเคฏ arguments เคชाเคธ เคจเคนीं เค•เคฐเคคे เคนै เคคो program เคฎें error เค†เคคी เคนै।  
  
Addition เค•े function เค•ो เค†เคช เค‡เคธ เคช्เคฐเค•ाเคฐ call เค•เคฐ เคธเค•เคคे เคนै।
/* Calling add function with arguments 2 and 7*/
add(2,7); 
C language เคฎें functions เค•ो 2 เคช्เคฐเค•ाเคฐ เคธे call เค•िเคฏा เคœा เคธเค•เคคा เคนै।
  • Call by Value – เค‡เคธ เคคเคฐीเค•े เคฎें argument เค•े เคฐूเคช เคฎें values เค”เคฐ variables เคชाเคธ เค•िเคฏे เคœाเคคे เคนै। 
  • Call by Reference – เค‡เคธ เคคเคฐीเค•े เคฎें argument เค•े เคฐूเคช เคฎें variables เค•ा reference เคชाเคธ เค•िเคฏा เคœाเคคा เคนै।  

CALL BY VALUE 

เคœเคฌ เค†เคช function call เค•เคฐเคคे เคธเคฎเคฏ argument เค•े เคฐूเคช เคฎें เค•ोเคˆ value เคชाเคธ เค•เคฐเคคे เคนै เคคो เคตเคน parameter variables เคฎें copy เคนो เคœाเคคी เคนै เค”เคฐ เค‡เคธเค•े เคฌाเคฆ เค‰เคจ variables เคชเคฐ operations perform เค•िเคฏे เคœाเคคे เคนै।
เค‡เคธी เคช्เคฐเค•ाเคฐ เคœเคฌ เค†เคช function เค•ो call เค•เคฐเคคे เคธเคฎเคฏ เค•ोเคˆ variable เคชाเคธ เค•เคฐเคคे เคนै เคคो เค…เคธเคฒ เคฎें เคตเคน variable function เคฎें เคจเคนीं pass เค•िเคฏा เคœाเคคा เคนै เคฌเคฒ्เค•ि เค‰เคธ variable เค•ी value parameter variable เคฎें copy เค•ी เคœाเคคी เคนै เค”เคฐ เค‰เคธเค•े เคฌाเคฆ เค‰เคธ parameter variable เคชเคฐ operations perform เค•िเคฏे เคœाเคคे เคนै। 
เคฏเคฆि เคŠเคชเคฐ เคฆिเค เค—เค addition เค•े function เค•ो call เค•เคฐเคคे เคธเคฎเคฏ เคฆो integer variables x เค”เคฐ y pass เค•िเคฏे เคœाเคँ เคคो เคเคธा เค•เคฐเคจे เคชเคฐ เค‰เคจ เคฆोเคจों variables เค•ी value parameter variables a เค”เคฐ b เคฎें copy เคนो เคœाเคฏेเค—ी เค”เคฐ เค‰เคจ เคชเคฐ addition perform เค•เคฐเค•े result return เค•िเคฏा เคœाเคเค—ा। 
เค‡เคธ เคคเคฐเคน เค•े function call เค•ो call by value เค•เคนा เคœाเคคा เคนै। เค‡เคธเคฎें เค…เคธเคฒ argument variables เค•ी value change เคจเคนीं เคนोเคคी เคนै เค”เคฐ เคœो เคญी operation เคนोเคคा เคนै เคตเคน parameter variables เคชเคฐ เคนी perform เคนोเคคा เคนै।
#include<stdio.h>
int add(int a, int b);
int main()
{
   int result;
   int x=5;
   int y=4;
   printf(“This addition is performed using function call by valuen”);
   /* Calling add function by value */
   result = add(x,y);
   printf(“n Result is : %d”,result);
   printf(“nn Value of a is %d and value of b is %d”,x,y);
}
/* Below function takes values from variables
as arguments and performs operations on them */
int add(int a, int b)
{
    int c;
    c=a+b;
    return c;
}
This addition is performed using function call by value
Result is 9
Value a is 5 and value of b is 4

CALL BY REFERENCE 

เค•िเคธी function เค•ो call เค•เคฐเคคे เคธเคฎเคฏ เค…เคธเคฒ variables pass เค•เคฐเคจे เค•ी เคฌเคœाเคฏ เค‰เคจเค•ा address เคญी เคชाเคธ เค•िเคฏा เคœा เคธเค•เคคा เคนै। เคเคธा เค•เคฐเคจे เคชเคฐ เค‰เคจ variables เค•ा address parameter variables เคฎें copy เคนोเค—ा เค”เคฐ parameter variable memory เคฎें เค…เคธเคฒ argument variables เค•ो เคนी point เค•เคฐेंเค—े। 
เค‡เคธ เคคเคฐเคน เค•े function call เค•ो call by reference เค•เคนा เคœाเคคा เคนै। เค‡เคธ เคคเคฐเคน เค•े function call เคฎें เค…เคธเคฒ argument variables เค•ा address pass เค•िเคฏा เคœाเคคा เคนै। เคเคธा เค•เคฐเคจे เคธे function เค•े เค…ंเคฆเคฐ เคฏเคฆि parameter variables เค•ी values เคฎें changes เค†เคคे เคนै เคคो เค‰เคธเคธे เค…เคธเคฒ argument variables เค•ी values เคฎें เคญी changes เค†เคคे เคนै। เคฏाเคจी parameters เคฎें change เค†เคจे เคชเคฐ arguments เคญी change เคนो เคœाเคคे เคนै। 
เค‡เคธ เคคเคฐเคน เค•े function call เคฎें arguments เค•ो address of operator (&) เค•े เคธाเคฅ pass เค•िเคฏा เคœाเคคा เคนै। เคฏเคน operator argument เค•ा address parameter variables เค•ो pass เค•เคฐเคคा เคนै। เค‡เคธเค•े เค…เคฒाเคตा function เค•े declaration เค”เคฐ definition เคฎें parameters เค•ो value at (*) operator เค•े เคธाเคฅ define เค•िเคฏा เคœाเคคा เคนै।
#include<stdio.h>
/* Function declaration with value at operator */
int add(int *s);
int main()
{
    int s=2;
    printf(“Call by Reference Demon”);
    /*  Function call with variable reference */
    add(&s);
    printf(“Sum is %dn”,s);
}
/* Function definition with value at operator */
int add(int *s)
{
     *s = *s+2;
     return 0;
}
Call by Reference Demo
Sum is 4

Example of C Functions

#include<stdio.h>

/* Function declaration */
int add(int a, int b);
int main()
{
   int result;
    printf(“This is  addition program using function!n”);
    /* Function call */
    result = add(2,7); 
    printf(“Result is : %d”, result);
 }

/* Function definition */
int add(int a, int b)
{
     int c;
     c = a + b;
    
     return c;
}       
This is addition program using function!
Result is : 9 

Comments

Popular posts from this blog

    METACHAR ACTER   UNIX  shell  เค…เคจेเค• เคฎेเคŸाเคšाเคฐेเค•्เคŸเคฐ เคช्เคฐोเคตाเค‡เคก เค•เคฐเคคा เคนै เคœो เค•िเคธी เคญी เคถैเคฒ เคธ्เค•เคซ्เคฐिเคช्เคค เคฎें เค‰เคจเค•ा เค‰เคธे เค•เคฐเคคे เคŸाเค‡เคฎ เคตिเคทेเคธ เคฎाเค‡เคจिंเค— เคฐเค–เคคे เค”เคฐ เคœเคฌ เคคเค• เค•ाเคถी เคธोเคตเคณे เคจเคนीं เคนो เคœाเคคे เคคเคฌ เค•ाเคŸ เค•िเคธी เคตเคฐ्เคก เค•ा เคंเคกिंเค— เค•ा เค•ाเคฐเคจ เคฌเคจเคคे เคนै।                                                     ex:--     เคเค• directory เคฎें เคซिเคฒो เค•ो เคฒिเคธ्เคŸिंเค— เค•เคฐเคคे เคŸाเค‡เคฎ เคเค• เคธिंเค—เคฒ เคšैเคฐेเค•्เคŸเคฐ เคฎें เคฐเค–ा เคœाเคคा เคนै เค”เคฐ * เคเค• เคธे เค…เคงिเค• เคตเคฐ्เคก เค•ो เคฎैเคšेเคธ เค•เคฐเคคा เคนै เคฏเคน เคถैเคฒ เค•े เค…เคงिเค•ांเคถ เคชเคค्เคฐों เค•ो เคฒिเคธ्เคŸ เคฆी เค—เคฏी เคนै เคœिเคจ्เคนे metacharacter เคฌोเคฒा  เคœाเคคा เคนै.   * ? [ ] " ' \    /    $ : ; ( ) | ^ < >  \.   เคจเคˆ เคฒाเค‡เคจ เคธ्เคชेเคธ เคคเคฌ   #!/bin/sh  echo hello; word  #!/bin/sh  echo "I have \$1200" 1. <  single quotes : all special charecters between these quotes lose their special.  ex. --...
UNIX in Hindi UNIX เคเค• multi tasking, multi user operating system  เคนै เคœिเคธे เคธเคจ 1969  เคฎें AT & T LABS  เคฎें เคฌเคจाเคฏा เค—เคฏा เคฅा। เคœिเคธे AT & T เคฎें เค•ाเคฎ เค•เคฐเคจे เคตाเคฒे computer  scientist  ken Thompson  &   Denis Ritchie and  เค‰เคจเค•े friends เคจे เคฎिเคฒเค•เคฐ  เคฌเคจाเคฏा เค—เคฏा เคฅा.  เคเคธे AT & T   เคจे เค…เคชเคจे เค‰เคธे เค•े เคฒिเค เคฌเคจाเคฏा เค—เคฏा เคฅा เคฒेเค•िเคจ เคฌाเคฆ เคฎें เคธเคจ 1970 เคฎें เค‡เคธे commercialize เค•เคฐ เคฆिเคฏा เค—เคฏा เคฅा।  เค‡เคธ Operating System เค•ो เฅ™ाเคธ เคคौเคฐ เคชเคฐ Programmers เค”เคฐ developers เค•े เคฒिเค เคฌเคจाเคฏा เค—เคฏा เคฅा। เค‡เคธเค•ी เคฌเคœเคน เคฏเคน เคฅी เค•ी เคฏเคน Modular Programming Interface design provide เค•เคฐเคคा เคฅा เคœिเคธे "Unix Philosophy" เคญी เค•เคนा เคœाเคคा เคนै। UNIX Operating System เค•ो 'C' เค”เคฐ Assembly Programming Languages เคฎें เคฒिเค–ा เค—เคฏा เคฅा। C Programming language เค•ो เค–ाเคธ เคคौเคฐ เคชเคฐ UNIX เคฌเคจाเคจे เค•े เคฒिเค เคนी develop เค•िเคฏा เค—เคฏा เคฅा เค”เคฐ เค‡เคธे เคญी Denis Ritchie เคฆ्เคตाเคฐा เคนी เคฌเคจाเคฏा เค—เคฏा เคฅा। เค†เคœ เคญी 'C' Programming Language เค•ो เคฌเคนुเคค เฅ™ाเคธ เคฎाเคจा เคœाเคคा เคนै เค•्เคฏूंเค•ि Device Drivers เค‡เคธी language เคฎें เคœ्เคฏाเคฆाเคคเคฐ เคฒिเค–े เคœाเคคे เคนैं เค”เคฐ เคธाเคฅ เคนी เค‡เคธे  Mother...
Addressing modes of microprocessor 8085 The way of specifying data to be operated by an instruction is called addressing Types of addressing modes – In 8085 microprocessor there are 5 types of addressing modes: Immediate Addressing Mode – In immediate addressing mode the source operand is always data. If the data is 8-bit, then the instruction will be of 2 bytes, if the data is of 16-bit then the instruction will be of 3 bytes. Examples: MVI B 45 (move the data 45H immediately to register B) LXI H 3050 (load the H-L pair with the operand 3050H immediately) JMP address (jump to the operand address immediately). Register Addressing Mode – In register addressing mode, the data to be operated is available inside the register(s) and register(s) is(are) operands. Therefore the operation is performed within various registers of the microprocessor. Examples: MOV A, B (move the contents of register B to register A) ADD B (add contents of registers A and B and s...