Variable Scope
จินดาพร คุณฑา 620710300
ขอบเขตตัวเเปร
1.Local Variables Scope
<?php
function local_var()
{
$num = 45; //local variable
echo "Local variable declared inside the function is: ". $num;
}
local_var();
?>
#include <stdio.h>
void myFunction() {
// Local variable that belongs to myFunction
int x = 5;
// Print the variable x
printf("%d", x);
}
int main() {
myFunction();
return 0;
}public SumExample {
public void calculateSum() {
int a = 5; // local variable
int b = 10; // local variable
int sum = a + b;
System.out.println("The sum is: " + sum);
} // a, b, and sum go out of scope here
}
2.Global Variables Scope
3.Static Variables Scope
หัวข้อ
PHP
C
Java
Python
Presentation
Video Clip
Reference
PHP :
C :
Java :
Python :
Last updated