C Tutorial

Define C

Define Programming

Programming Approach

First C Program

TurboC Shortcut keys

Compiler vs Interpreter

C Variable

C Keywords

C Data Types

C Comments

C Operators

Hierarchy of Operators

Ex: Arithmetic Operator

C Formatting Output

C Escape Sequence

C if statement

Ex: If statement

C Switch statement

Ex: Switch

Increment / Decrement

C Loops

Ex: Loops

C Nesting Of Loops

Ex: Nested Loops

C Jumping Statements

C Exit(), Gotoxy()

C Arrays 1D

Ex: Arrays 1D

C Arrays 2D

Ex: Arrays 2D

C Sorting

ASCII Value

Character I/O Function

Ex: Character

C String Functions

Ex: Strings

Array of Strings

C Math Functions

User-defined Function

Exercise Function

Local, Reference variable

Function Calling types

Array Passing Function

Recursion Function

Ex: Recursion Function

Constant Variable

Storage Class

C Header Files

C Preprocessor

C Pointers

Pointer to Pointer

C Structures

Exercise Structure

C Typedef

C Enumeration

C File Handling

Ex: File Handling

Command Line Argument

MCQ

Question-Answer

Page Stats

Visitor: 344

Local Variable

A variable that is declared inside the function or block is called local variable.

Example 1: Local varible

void show();
void main()
{
   int a=10; //Local variable
   printf("Value inside main function is:\n");
   printf("A = %d\n",a);
   void show();
   getch();
}
void show()
{
   int a=20; //Local variable
   printf("Value outside main function is:\n");
   printf("A = %d\n",a);
}
Value inside main function is:
A = 10

Value outside main function is:
A = 20

Reference variable

Reference variable refers to another variable, it does not occupy memory instead it refer to another variable. Any changes made to reference variable or refered variable, reflect to one another.

Example 2: Reference varible

void main()
{
    int a=10;
    int &b=a; //b is refered to a
    clrscr();
    printf("A=%d\n",a);
    printf("B=%d\n",b);
	
	a=20;
	printf("A=%d\n",a);
    printf("B=%d\n",b);
	
	b=30;
	printf("A=%d\n",a);
    printf("B=%d\n",b);
    getch();
}
A=10
B=10
A=20
B=20
A=30
B=30