SlideShare a Scribd company logo
1 of 19
GROUP # 04
GROUP MEMBERS;
HAFIZ AHMAD ALI EN-15024
SAQIB KHOKHAR EN-15017
HASNAIN BILAL EN-15025
GLOBAL VARIABLE
• GLOBAL VARIABLES HOLD THEIR VALUES THROUGHOUT THE LIFETIME OF YOUR PROGRAM AND
THEY CAN BE ACCESSED INSIDE ANY OF THE FUNCTIONS DEFINED FOR THE PROGRAM.
• GLOBAL AND LOCAL VARIABLES
• A LOCAL VARIABLE IS A VARIABLE THAT IS DECLARED INSIDE A FUNCTION.
• A GLOBAL VARIABLE IS A VARIABLE THAT IS DECLARED OUTSIDE ALL FUNCTIONS.
• A LOCAL VARIABLE CAN ONLY BE USED IN THE FUNCTION WHERE IT IS DECLARED.
• A GLOBAL VARIABLE CAN BE USED IN ALL FUNCTIONS.
#include<stdio.h> // Global variables int A; int B; int Add() { return A + B; } int main() { int answer; // Local variable A = 5; B = 7; answer = Add(); printf("%dn",answer); return 0; }
Sorting
 To arrange a set of items in sequence.
 Many applications require sorting;
 Many applications perform sorting when
they don't have to;
 Many applications use inefficient sorting
algorithms.
Sorting Applications
 To prepare a list of student ID, names, and
scores in a table (sorted by ID or name) for
easy checking.
 To prepare a list of scores before letter
grade assignment.
 To produce a list of horses after a race
(sorted by the finishing times) for payoff
calculation.
 To prepare an originally unsorted array for
ordered binary searching.
Static and Automatic
Variables
• Automatic variable - memory is allocated
at block entry and deallocated at block
exit
• Static variable - memory remains
allocated as long as the program
executes
• Variables declared outside of any block
are static variables
• By default, variables declared within a
block are automatic variables
• Declare a static variable within a block by
using the reserved word static
Static and Automatic
Variables (continued)
• The syntax for declaring a static variable
is:
static dataType identifier;
• The statement
static int x;
declares x to be a static variable of the type
int
• Static variables declared within a block
are local to the block
• Their scope is the same as any other
Summary (continued)
• An automatic variable is a variable for
which memory is allocated on function
(or block) entry and deallocated on
function (or block) exit
• A static variable is a variable for which
memory remains allocated throughout
the execution of the program
• C allows functions to have default
parameters
FUNCTIONS
Basically there are two categories of function:
1. Predefined functions: available in C / C++
standard library such as stdio.h, math.h,
string.h etc.
2. User-defined functions: functions that
programmers create for specialized tasks such
as graphic and multimedia libraries,
implementation extensions or dependent etc.
FUNCTION & ARRAY:
FOR A FUNCTION TO RECEIVE AN ARRAY THROUGH A FUNCTION CALL, THE
FUNCTION’S PARAMETER LIST MUST SPECIFY THAT AN ARRAY WILL BE RECEIVED.
SYNTAX
INDICATING THAT MODIFY ARRAY EXPECTS TO RECEIVE AN ARRAY OF INTEGERS
IN PARAMETER B AND THE NUMBER OF ARRAY ELEMENTS IN PARAMETER SIZE.
THE SIZE OF THE ARRAY IS NOT REQUIRED BETWEEN
THE ARRAY BRACKETS.
#include <stdio.h>
float average(float a[]);
int main(){
float avg, c[]={23.4, 55, 22.6, 3, 40.5, 18};
avg=average(c); /* Only name of array is passed as argument. */
printf("Average age=%.2f",avg);
return 0;
}
float average(float a[ ])
{
int i;
float avg, sum=0.0;
for(i=0;i<6;++i){
sum+=a[i];
}
avg =(sum/6);
return avg;
}
Output Average age=27.08
C program to pass an array containing age of person to a function. This function should find average
age and display the average age in main function.
#include
void Function(int c[2][2]);
int main(){
int c[2][2],i,j;
printf("Enter 4 numbers:n");
for(i=0;i<2;++i)
for(j=0;j<2;++j){
scanf("%d",&c[i][j]);
}
Function(c); /* passing multi-dimensional array to function */
return 0;
}
void Function(int c[2][2]){
/* Instead to above line, void Function(int c[][2]){ is also valid */
int i,j;
printf("Displaying:n");
for(i=0;i<2;++i)
for(j=0;j<2;++j)
printf("%dn",c[i][j]);
} Output
Enter 4 numbers:
2
3
4
5
Displaying:
2
3
4
5
Global variables, sorting static variables,function and arrays,

More Related Content

What's hot

Storage Classes and Functions
Storage Classes and FunctionsStorage Classes and Functions
Storage Classes and Functions
Jake Bond
 

What's hot (20)

Storage classes in C
Storage classes in C Storage classes in C
Storage classes in C
 
Method parameters in c#
Method parameters in c#Method parameters in c#
Method parameters in c#
 
Fda unit 1 lec 1
Fda unit 1 lec  1Fda unit 1 lec  1
Fda unit 1 lec 1
 
Storage Classes and Functions
Storage Classes and FunctionsStorage Classes and Functions
Storage Classes and Functions
 
201801 CSE240 Lecture 06
201801 CSE240 Lecture 06201801 CSE240 Lecture 06
201801 CSE240 Lecture 06
 
parameter passing in c#
parameter passing in c#parameter passing in c#
parameter passing in c#
 
Storage classes in C
Storage classes in CStorage classes in C
Storage classes in C
 
User defined functions
User defined functionsUser defined functions
User defined functions
 
Types of function call
Types of function callTypes of function call
Types of function call
 
Cinfo
CinfoCinfo
Cinfo
 
User Defined Functions in C
User Defined Functions in CUser Defined Functions in C
User Defined Functions in C
 
Functions in c
Functions in cFunctions in c
Functions in c
 
Increment and Decrement operators in C++
Increment and Decrement operators in C++Increment and Decrement operators in C++
Increment and Decrement operators in C++
 
Presentation on function
Presentation on functionPresentation on function
Presentation on function
 
Storage class in c
Storage class in cStorage class in c
Storage class in c
 
Functions
FunctionsFunctions
Functions
 
Storage class
Storage classStorage class
Storage class
 
Function in c
Function in cFunction in c
Function in c
 
Function in C program
Function in C programFunction in C program
Function in C program
 
Learning the C Language
Learning the C LanguageLearning the C Language
Learning the C Language
 

Viewers also liked

Transients characteristics
Transients characteristicsTransients characteristics
Transients characteristics
Aldo Uribe
 
Pecha - Kucha
Pecha - KuchaPecha - Kucha
Pecha - Kucha
Lookgade
 
Managerial Accounting
Managerial AccountingManagerial Accounting
Managerial Accounting
Melody Chen
 
Management reporting
Management reportingManagement reporting
Management reporting
Pw Botha
 
Requirements - Part 1
Requirements - Part 1Requirements - Part 1
Requirements - Part 1
stat
 
Lesson 5: Thesis Statements
Lesson 5: Thesis StatementsLesson 5: Thesis Statements
Lesson 5: Thesis Statements
bsimoneaux
 

Viewers also liked (20)

CS Unitec Nut Runners
CS Unitec Nut RunnersCS Unitec Nut Runners
CS Unitec Nut Runners
 
Stat family :Role of Stat 3 in skin disorders by yousry
Stat family :Role of Stat 3 in skin disorders  by yousryStat family :Role of Stat 3 in skin disorders  by yousry
Stat family :Role of Stat 3 in skin disorders by yousry
 
JACK-IT® Line Card
JACK-IT® Line CardJACK-IT® Line Card
JACK-IT® Line Card
 
Transients characteristics
Transients characteristicsTransients characteristics
Transients characteristics
 
The osterberg cell static loading test
The osterberg cell static loading testThe osterberg cell static loading test
The osterberg cell static loading test
 
Grammarware Memes
Grammarware MemesGrammarware Memes
Grammarware Memes
 
Pecha - Kucha
Pecha - KuchaPecha - Kucha
Pecha - Kucha
 
Managerial Accounting
Managerial AccountingManagerial Accounting
Managerial Accounting
 
E470 20MnV6 Steel Pipe for Hydraulic Cylinders
E470 20MnV6 Steel Pipe for Hydraulic CylindersE470 20MnV6 Steel Pipe for Hydraulic Cylinders
E470 20MnV6 Steel Pipe for Hydraulic Cylinders
 
Management reporting
Management reportingManagement reporting
Management reporting
 
Requirements - Part 1
Requirements - Part 1Requirements - Part 1
Requirements - Part 1
 
Measurement of hydraulic pipe and hose dynamic
Measurement of hydraulic pipe and hose dynamicMeasurement of hydraulic pipe and hose dynamic
Measurement of hydraulic pipe and hose dynamic
 
Stat3 protein in psoriasis by yousry
Stat3 protein in psoriasis  by yousryStat3 protein in psoriasis  by yousry
Stat3 protein in psoriasis by yousry
 
Hydraulic Ram; by Allen Inversin, VITA
Hydraulic Ram; by Allen Inversin, VITAHydraulic Ram; by Allen Inversin, VITA
Hydraulic Ram; by Allen Inversin, VITA
 
Apache zookeeper seminar_trinh_viet_dung_03_2016
Apache zookeeper seminar_trinh_viet_dung_03_2016Apache zookeeper seminar_trinh_viet_dung_03_2016
Apache zookeeper seminar_trinh_viet_dung_03_2016
 
CS Unitec Pneumatic & Hydraulic Nut Runners
CS Unitec Pneumatic & Hydraulic Nut RunnersCS Unitec Pneumatic & Hydraulic Nut Runners
CS Unitec Pneumatic & Hydraulic Nut Runners
 
Hidraulika
HidraulikaHidraulika
Hidraulika
 
Inference of the JAK-STAT Gene Network via Graphical Models
Inference of the JAK-STAT Gene Network via Graphical ModelsInference of the JAK-STAT Gene Network via Graphical Models
Inference of the JAK-STAT Gene Network via Graphical Models
 
Hydraulic losses in pipe
Hydraulic losses in pipeHydraulic losses in pipe
Hydraulic losses in pipe
 
Lesson 5: Thesis Statements
Lesson 5: Thesis StatementsLesson 5: Thesis Statements
Lesson 5: Thesis Statements
 

Similar to Global variables, sorting static variables,function and arrays,

Chapter 11 Function
Chapter 11 FunctionChapter 11 Function
Chapter 11 Function
Deepak Singh
 
What is storage class
What is storage classWhat is storage class
What is storage class
Isha Aggarwal
 
Data structure scope of variables
Data structure scope of variablesData structure scope of variables
Data structure scope of variables
Saurav Kumar
 

Similar to Global variables, sorting static variables,function and arrays, (20)

C language
C languageC language
C language
 
STORAGE CLASS.pptx
STORAGE CLASS.pptxSTORAGE CLASS.pptx
STORAGE CLASS.pptx
 
C language updated
C language updatedC language updated
C language updated
 
visiblity and scope.pptx
visiblity and scope.pptxvisiblity and scope.pptx
visiblity and scope.pptx
 
Unit iii
Unit iiiUnit iii
Unit iii
 
CH.4FUNCTIONS IN C (1).pptx
CH.4FUNCTIONS IN C (1).pptxCH.4FUNCTIONS IN C (1).pptx
CH.4FUNCTIONS IN C (1).pptx
 
Chapter 11 Function
Chapter 11 FunctionChapter 11 Function
Chapter 11 Function
 
Chapter Introduction to Modular Programming.ppt
Chapter Introduction to Modular Programming.pptChapter Introduction to Modular Programming.ppt
Chapter Introduction to Modular Programming.ppt
 
Storage classes
Storage classesStorage classes
Storage classes
 
Structure of a C program
Structure of a C programStructure of a C program
Structure of a C program
 
Introduction to C programming
Introduction to C programmingIntroduction to C programming
Introduction to C programming
 
Terms and Definitions.pdf
Terms and Definitions.pdfTerms and Definitions.pdf
Terms and Definitions.pdf
 
What is storage class
What is storage classWhat is storage class
What is storage class
 
Functions in c
Functions in cFunctions in c
Functions in c
 
Storage class
Storage classStorage class
Storage class
 
Function (rule in programming)
Function (rule in programming)Function (rule in programming)
Function (rule in programming)
 
C language
C languageC language
C language
 
Data structure scope of variables
Data structure scope of variablesData structure scope of variables
Data structure scope of variables
 
CH.4FUNCTIONS IN C_FYBSC(CS).pptx
CH.4FUNCTIONS IN C_FYBSC(CS).pptxCH.4FUNCTIONS IN C_FYBSC(CS).pptx
CH.4FUNCTIONS IN C_FYBSC(CS).pptx
 
C
CC
C
 

Recently uploaded

scipt v1.pptxcxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx...
scipt v1.pptxcxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx...scipt v1.pptxcxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx...
scipt v1.pptxcxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx...
HenryBriggs2
 
Call Girls in South Ex (delhi) call me [🔝9953056974🔝] escort service 24X7
Call Girls in South Ex (delhi) call me [🔝9953056974🔝] escort service 24X7Call Girls in South Ex (delhi) call me [🔝9953056974🔝] escort service 24X7
Call Girls in South Ex (delhi) call me [🔝9953056974🔝] escort service 24X7
9953056974 Low Rate Call Girls In Saket, Delhi NCR
 
DeepFakes presentation : brief idea of DeepFakes
DeepFakes presentation : brief idea of DeepFakesDeepFakes presentation : brief idea of DeepFakes
DeepFakes presentation : brief idea of DeepFakes
MayuraD1
 
Standard vs Custom Battery Packs - Decoding the Power Play
Standard vs Custom Battery Packs - Decoding the Power PlayStandard vs Custom Battery Packs - Decoding the Power Play
Standard vs Custom Battery Packs - Decoding the Power Play
Epec Engineered Technologies
 
+97470301568>> buy weed in qatar,buy thc oil qatar,buy weed and vape oil in d...
+97470301568>> buy weed in qatar,buy thc oil qatar,buy weed and vape oil in d...+97470301568>> buy weed in qatar,buy thc oil qatar,buy weed and vape oil in d...
+97470301568>> buy weed in qatar,buy thc oil qatar,buy weed and vape oil in d...
Health
 
notes on Evolution Of Analytic Scalability.ppt
notes on Evolution Of Analytic Scalability.pptnotes on Evolution Of Analytic Scalability.ppt
notes on Evolution Of Analytic Scalability.ppt
MsecMca
 

Recently uploaded (20)

Navigating Complexity: The Role of Trusted Partners and VIAS3D in Dassault Sy...
Navigating Complexity: The Role of Trusted Partners and VIAS3D in Dassault Sy...Navigating Complexity: The Role of Trusted Partners and VIAS3D in Dassault Sy...
Navigating Complexity: The Role of Trusted Partners and VIAS3D in Dassault Sy...
 
scipt v1.pptxcxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx...
scipt v1.pptxcxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx...scipt v1.pptxcxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx...
scipt v1.pptxcxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx...
 
Call Girls in South Ex (delhi) call me [🔝9953056974🔝] escort service 24X7
Call Girls in South Ex (delhi) call me [🔝9953056974🔝] escort service 24X7Call Girls in South Ex (delhi) call me [🔝9953056974🔝] escort service 24X7
Call Girls in South Ex (delhi) call me [🔝9953056974🔝] escort service 24X7
 
A CASE STUDY ON CERAMIC INDUSTRY OF BANGLADESH.pptx
A CASE STUDY ON CERAMIC INDUSTRY OF BANGLADESH.pptxA CASE STUDY ON CERAMIC INDUSTRY OF BANGLADESH.pptx
A CASE STUDY ON CERAMIC INDUSTRY OF BANGLADESH.pptx
 
Introduction to Serverless with AWS Lambda
Introduction to Serverless with AWS LambdaIntroduction to Serverless with AWS Lambda
Introduction to Serverless with AWS Lambda
 
School management system project Report.pdf
School management system project Report.pdfSchool management system project Report.pdf
School management system project Report.pdf
 
Hazard Identification (HAZID) vs. Hazard and Operability (HAZOP): A Comparati...
Hazard Identification (HAZID) vs. Hazard and Operability (HAZOP): A Comparati...Hazard Identification (HAZID) vs. Hazard and Operability (HAZOP): A Comparati...
Hazard Identification (HAZID) vs. Hazard and Operability (HAZOP): A Comparati...
 
Work-Permit-Receiver-in-Saudi-Aramco.pptx
Work-Permit-Receiver-in-Saudi-Aramco.pptxWork-Permit-Receiver-in-Saudi-Aramco.pptx
Work-Permit-Receiver-in-Saudi-Aramco.pptx
 
DeepFakes presentation : brief idea of DeepFakes
DeepFakes presentation : brief idea of DeepFakesDeepFakes presentation : brief idea of DeepFakes
DeepFakes presentation : brief idea of DeepFakes
 
Unleashing the Power of the SORA AI lastest leap
Unleashing the Power of the SORA AI lastest leapUnleashing the Power of the SORA AI lastest leap
Unleashing the Power of the SORA AI lastest leap
 
Bridge Jacking Design Sample Calculation.pptx
Bridge Jacking Design Sample Calculation.pptxBridge Jacking Design Sample Calculation.pptx
Bridge Jacking Design Sample Calculation.pptx
 
COST-EFFETIVE and Energy Efficient BUILDINGS ptx
COST-EFFETIVE  and Energy Efficient BUILDINGS ptxCOST-EFFETIVE  and Energy Efficient BUILDINGS ptx
COST-EFFETIVE and Energy Efficient BUILDINGS ptx
 
Standard vs Custom Battery Packs - Decoding the Power Play
Standard vs Custom Battery Packs - Decoding the Power PlayStandard vs Custom Battery Packs - Decoding the Power Play
Standard vs Custom Battery Packs - Decoding the Power Play
 
Employee leave management system project.
Employee leave management system project.Employee leave management system project.
Employee leave management system project.
 
Double Revolving field theory-how the rotor develops torque
Double Revolving field theory-how the rotor develops torqueDouble Revolving field theory-how the rotor develops torque
Double Revolving field theory-how the rotor develops torque
 
FEA Based Level 3 Assessment of Deformed Tanks with Fluid Induced Loads
FEA Based Level 3 Assessment of Deformed Tanks with Fluid Induced LoadsFEA Based Level 3 Assessment of Deformed Tanks with Fluid Induced Loads
FEA Based Level 3 Assessment of Deformed Tanks with Fluid Induced Loads
 
+97470301568>> buy weed in qatar,buy thc oil qatar,buy weed and vape oil in d...
+97470301568>> buy weed in qatar,buy thc oil qatar,buy weed and vape oil in d...+97470301568>> buy weed in qatar,buy thc oil qatar,buy weed and vape oil in d...
+97470301568>> buy weed in qatar,buy thc oil qatar,buy weed and vape oil in d...
 
Thermal Engineering -unit - III & IV.ppt
Thermal Engineering -unit - III & IV.pptThermal Engineering -unit - III & IV.ppt
Thermal Engineering -unit - III & IV.ppt
 
notes on Evolution Of Analytic Scalability.ppt
notes on Evolution Of Analytic Scalability.pptnotes on Evolution Of Analytic Scalability.ppt
notes on Evolution Of Analytic Scalability.ppt
 
A Study of Urban Area Plan for Pabna Municipality
A Study of Urban Area Plan for Pabna MunicipalityA Study of Urban Area Plan for Pabna Municipality
A Study of Urban Area Plan for Pabna Municipality
 

Global variables, sorting static variables,function and arrays,

  • 1.
  • 2. GROUP # 04 GROUP MEMBERS; HAFIZ AHMAD ALI EN-15024 SAQIB KHOKHAR EN-15017 HASNAIN BILAL EN-15025
  • 3. GLOBAL VARIABLE • GLOBAL VARIABLES HOLD THEIR VALUES THROUGHOUT THE LIFETIME OF YOUR PROGRAM AND THEY CAN BE ACCESSED INSIDE ANY OF THE FUNCTIONS DEFINED FOR THE PROGRAM. • GLOBAL AND LOCAL VARIABLES • A LOCAL VARIABLE IS A VARIABLE THAT IS DECLARED INSIDE A FUNCTION. • A GLOBAL VARIABLE IS A VARIABLE THAT IS DECLARED OUTSIDE ALL FUNCTIONS. • A LOCAL VARIABLE CAN ONLY BE USED IN THE FUNCTION WHERE IT IS DECLARED. • A GLOBAL VARIABLE CAN BE USED IN ALL FUNCTIONS.
  • 4. #include<stdio.h> // Global variables int A; int B; int Add() { return A + B; } int main() { int answer; // Local variable A = 5; B = 7; answer = Add(); printf("%dn",answer); return 0; }
  • 5. Sorting  To arrange a set of items in sequence.  Many applications require sorting;  Many applications perform sorting when they don't have to;  Many applications use inefficient sorting algorithms.
  • 6. Sorting Applications  To prepare a list of student ID, names, and scores in a table (sorted by ID or name) for easy checking.  To prepare a list of scores before letter grade assignment.  To produce a list of horses after a race (sorted by the finishing times) for payoff calculation.  To prepare an originally unsorted array for ordered binary searching.
  • 7.
  • 8.
  • 9. Static and Automatic Variables • Automatic variable - memory is allocated at block entry and deallocated at block exit • Static variable - memory remains allocated as long as the program executes • Variables declared outside of any block are static variables • By default, variables declared within a block are automatic variables • Declare a static variable within a block by using the reserved word static
  • 10. Static and Automatic Variables (continued) • The syntax for declaring a static variable is: static dataType identifier; • The statement static int x; declares x to be a static variable of the type int • Static variables declared within a block are local to the block • Their scope is the same as any other
  • 11. Summary (continued) • An automatic variable is a variable for which memory is allocated on function (or block) entry and deallocated on function (or block) exit • A static variable is a variable for which memory remains allocated throughout the execution of the program • C allows functions to have default parameters
  • 12. FUNCTIONS Basically there are two categories of function: 1. Predefined functions: available in C / C++ standard library such as stdio.h, math.h, string.h etc. 2. User-defined functions: functions that programmers create for specialized tasks such as graphic and multimedia libraries, implementation extensions or dependent etc.
  • 13. FUNCTION & ARRAY: FOR A FUNCTION TO RECEIVE AN ARRAY THROUGH A FUNCTION CALL, THE FUNCTION’S PARAMETER LIST MUST SPECIFY THAT AN ARRAY WILL BE RECEIVED. SYNTAX INDICATING THAT MODIFY ARRAY EXPECTS TO RECEIVE AN ARRAY OF INTEGERS IN PARAMETER B AND THE NUMBER OF ARRAY ELEMENTS IN PARAMETER SIZE. THE SIZE OF THE ARRAY IS NOT REQUIRED BETWEEN THE ARRAY BRACKETS.
  • 14.
  • 15. #include <stdio.h> float average(float a[]); int main(){ float avg, c[]={23.4, 55, 22.6, 3, 40.5, 18}; avg=average(c); /* Only name of array is passed as argument. */ printf("Average age=%.2f",avg); return 0; } float average(float a[ ]) { int i; float avg, sum=0.0; for(i=0;i<6;++i){ sum+=a[i]; } avg =(sum/6); return avg; } Output Average age=27.08 C program to pass an array containing age of person to a function. This function should find average age and display the average age in main function.
  • 16.
  • 17. #include void Function(int c[2][2]); int main(){ int c[2][2],i,j; printf("Enter 4 numbers:n"); for(i=0;i<2;++i) for(j=0;j<2;++j){ scanf("%d",&c[i][j]); } Function(c); /* passing multi-dimensional array to function */ return 0; }
  • 18. void Function(int c[2][2]){ /* Instead to above line, void Function(int c[][2]){ is also valid */ int i,j; printf("Displaying:n"); for(i=0;i<2;++i) for(j=0;j<2;++j) printf("%dn",c[i][j]); } Output Enter 4 numbers: 2 3 4 5 Displaying: 2 3 4 5