Global variable in c

 global variable👇                                                                                                                                                                               

#include <stdio.h>

// you can write below statement if you want it doesnot effect the program

///void display ();

int a, b;

int main()

{

    a=12;

    b=13;


display ();

    return 0;

}

void display (){

    

   printf("sum of %d and %d is %d\n " , a,b,(a+b)); 

   //or

   //printf("sum of %d and %d is %d\n" , a, b, a+b);

}

Comments

Popular posts from this blog

Factors : using C

Cross shaped pattern

Factorial ! calculation