Sun Studio 12: C User's Guide

D.1.14 Mixed Declarations and Code

6.8.2 Compound statement

The C compiler now accepts mixing type declarations with executable code as shown by the following example:


#include <stdio.h>

int main(void){
  int num1 = 3;
  printf("%d\n", num1);

  int num2 = 10;
  printf("%d\n", num2);
  return(0);
}