Assign value to global variable

Tuesday, August 4th, 2009

#include <stdio.h>

int count;

int main(void)
{
  extern int count; /* this refers to global count */

  count = 10;
  printf("%d", count);

  return 0;
}

           
       

This type is local to this block

Saturday, July 25th, 2009

 
SQL>
SQL>
SQL> CREATE OR REPLACE TYPE NameList AS
  2    VARRAY(20) OF VARCHAR2(30);
  3  /

Type created.

SQL>
SQL>
SQL> DECLARE
  2
  3    TYPE DateList IS VARRAY(10) OF DATE;
  4
  5    v_Dates DateList;
  6    v_Names NameList;
  7  BEGIN
  8    NULL;
  9  END;
 10  /

PL/SQL procedure successfully completed.

SQL>
SQL>

 

Variable Scope: Function

Sunday, June 28th, 2009

Imports System
Imports System.Diagnostics

Public Class MainClass

    Shared Sub Main()
        For i As Integer = 1 To 5
            Dim j As Integer = 3
            If i = j Then
                Dim M As Integer = i + j
                Console.WriteLine("M: " & M)
            Else
                Dim N As Integer = i * j
                Console.WriteLine("N: " & N)
            End If

            Dim k As Integer = 123
            Console.WriteLine("k: " & k)
        Next i
    End Sub
End Class

           
       

Variable Scope: A Variable Declared Within a Function Is Unavailable Outside the Function

Friday, June 26th, 2009

<html>
<head>
<title>Variable Scope: A Variable Declared Within a Function Is Unavailable Outside the Function</title>
</head>
<body>
<?php

function test() {
     $testvariable = "this is a test variable";
}
print "test variable: $testvariable<br>";

?>
</body>
</html>