Global Variables

#include <stdio.h>

/* global variable declaration */
int g;

int main () {

  /* local variable declaration */
  int a, b;


  a = 10;
  b = 20;
  g = a + b;

  printf ("value of a = %d, b = %d and g = %d\n", a, b, g);

  return 0;
}


OUTPUT:-
value of a = 10, b = 20 and g = 30

Comments

Popular posts from this blog

string copy in c

Structures as Function Arguments

Local Variables