Demonstrates local variables within blocks. - C Function

C examples for Function:Local Variable

Description

Demonstrates local variables within blocks.

Demo Code

#include <stdio.h>

int main( void )
{
    int count = 0;

    printf("\nOutside the block, count = %d", count);

    {//from w  w  w  . j  a v  a  2 s  .  c  o m
      /* Define a variable local to the block. */

      int count = 999;
      printf("\nWithin the block, count = %d", count);
    }

    printf("\nOutside the block again, count = %d\n", count);
    return 0;
}

Related Tutorials