global and local variables
This commit is contained in:
		@@ -1,5 +1,7 @@
 | 
			
		||||
2024-11-01  Mert Gör  <mertgor@masscollabs.xyz>
 | 
			
		||||
 | 
			
		||||
	* c-basic/global_local.c: global and local variable
 | 
			
		||||
 | 
			
		||||
	* c-basic/file_scope.c (foo): file scope example
 | 
			
		||||
 | 
			
		||||
2024-10-30  Mert Gör  <mertgor@masscollabs.xyz>
 | 
			
		||||
 
 | 
			
		||||
							
								
								
									
										21
									
								
								c-basic/global_local.c
									
									
									
									
									
										Normal file
									
								
							
							
						
						
									
										21
									
								
								c-basic/global_local.c
									
									
									
									
									
										Normal file
									
								
							@@ -0,0 +1,21 @@
 | 
			
		||||
#include <stdio.h>
 | 
			
		||||
 | 
			
		||||
int a;
 | 
			
		||||
 | 
			
		||||
void foo()
 | 
			
		||||
{
 | 
			
		||||
  int a;
 | 
			
		||||
 | 
			
		||||
  a = 10; 
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
int main()
 | 
			
		||||
{
 | 
			
		||||
  a = 20; 
 | 
			
		||||
 | 
			
		||||
  printf("%d\n", a); 
 | 
			
		||||
  foo();
 | 
			
		||||
  printf("%d\n", a);
 | 
			
		||||
 | 
			
		||||
  return 0;
 | 
			
		||||
}
 | 
			
		||||
		Reference in New Issue
	
	Block a user