Tuesday, June 11, 2019

accessing global variable from the main function in c

#include <stdio.h>


int g;

int main () {

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

  /* actual initialization */
  a = 10;
  b = 20;
  g = a + b;

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

  return 0;
}


output::

No comments:

Post a Comment

python class topic video