SlideShare a Scribd company logo
1 of 6
SUBJECT NAME-Fundamentalsof ComputerProgramming SUBJECT CODE-21CSH101
STUDENT’S NAME –Ankita Sharma
STUDENT’S UID – 21BCS2219
CLASS AND GROUP –13A
SEMESTER –1
EXPERIMENT NUMBER – 3.1
AIM OF THE EXPERIMENT– To LEARN HOW TO USE POINTERS
IN C
A) WAP to read an array of elements and print the same in the reverse
order along with their addresses using pointer.
B)WAP to read an array of elements and print the same in the reverse
order along with their addresses using pointer.
FLOWCHART/ALGORITHM-
A)
STEP 1: START
o STEP 2: INITIALIZE arr[] = { }
o STEP 3: length= sizeof(arr)/sizeof(arr[0])
o STEP 4: PRINT "Original Array:"
o STEP 5: REPEAT STEP 6 and STEP 7 UNTIL i<length
o STEP 6: PRINT arr[i]
o STEP 7: i=i+1
o STEP 8: PRINT new line.
o STEP 9: PRINT "Array in reverse order"
o STEP 10: SET i=length-1. REPEAT STEP 11 and STEP 12 UNTIL i>=0
o STEP 11: PRINT a[i]
o STEP 12: i=i-1
o STEP 13: RETURN 0.
o STEP 14: END
B)
SUBJECT NAME-Fundamentalsof ComputerProgramming SUBJECT CODE-21CSH101
Step 1: START
Step 2: declare a function
Step 3: declare integer variables
Step 4: enter two comparable values
Step 5: then enter pointer variables to store the values
Step 6: then define the function
Step 7: if the value pointed by pointer m is greater than it return the address
stored in pointer n
Step 8: else it will return the address stored in pointer n
Step 9: end
PROGRAM CODE
#include <stdio.h>
int main()
{
int n, i, arr1[15];
int *pt;
printf("nn Pointer : Print the elements of an array in reverse order :n");
printf(" Input the number of elements to store in the array (max 15) :n
");
scanf("%d",&n);
pt = &arr1[0];
printf(" Input %d number of elements in the array : n",n);
for(i=0;i<n;i++)
{
printf(" element - %d : ",i+1);
scanf("%d",pt);
pt++;
}
pt = &arr1[n - 1];
printf("n The elements of array in reverse order are :");
for (i = n; i > 0; i--)
{
printf("n element - %d : %d ", i, *pt);
pt--;
}
printf("nn");
SUBJECT NAME-Fundamentalsof ComputerProgramming SUBJECT CODE-21CSH101
return 0;
}
B)
#include <stdio.h>
int *getMax(int *, int *);
int main(void) {
int x, y;
printf(" FIND MAX VALUEn Enter two integers-n ");
scanf("%d%d", &x,&y);
int *max = NULL;
max = getMax(&x, &y);
printf(" Max value: %dn", *max);
return 0;
}
int *getMax(int *m, int *n) {
if (*m > *n) {
return m;
}
else {
return n;
}
}
ERRORS ENCOUNTERED DURING PROGRAM’S
EXECUTION
(Kindly jot down the compile time errors encountered)
No errors encountered.
SUBJECT NAME-Fundamentalsof ComputerProgramming SUBJECT CODE-21CSH101
PROGRAMS’ EXPLANATION (in brief)
In program(A), we need to print the elements of the array in reverse order
that is; the last element should be displayed first, followed by second last
element and so on.
B)
Since the name of an array is a pointer to the 0th element of the array. Here
we are passing two arguments to the function return_pointer(). The arr is
passed using call by reference (notice that name of the array is not preceded
by & operator because the name of the array is a constant pointer to the 0th
element of the 1-D array) and i is passed using call by value. Inside the
function pointer p is incremented by n and reassigned to p. Finally, the
pointer p is returned to the main() function and reassigned to ptr.
Never return a pointer to local variable from a function.
OUTPUT
SUBJECT NAME-Fundamentalsof ComputerProgramming SUBJECT CODE-21CSH101
B)
SUBJECT NAME-Fundamentalsof ComputerProgramming SUBJECT CODE-21CSH101
LEARNING OUTCOMES
 Remember the concepts related to fundamentals of C language, draw flowcharts and
write algorithm/pseudocode.
 Understand the way of execution and debug programs in C language.
 Apply various constructs, loops, functions to solve mathematical and scientific problem.
 Analyze the dynamic behavior of memory by the use of pointers.
 Design and develop modular programs for real world problems using control structure
and selection structure.
EVALUATION COLUMN (To be filled by concerned faculty only)
Sr. No. Parameters Maximum
Marks
Marks
Obtained
1. Worksheet Completion including writing
learning objective/ Outcome
10
2. Post-Lab Quiz Result 5
3. Student engagement in Simulation/
Performance/ Pre-Lab Questions
5
4. Total Marks 20

More Related Content

What's hot

Expressions using operator in c
Expressions using operator in cExpressions using operator in c
Expressions using operator in cSaranya saran
 
Decision making and branching
Decision making and branchingDecision making and branching
Decision making and branchingSaranya saran
 
Programming fundamentals
Programming fundamentalsProgramming fundamentals
Programming fundamentalsZaibi Gondal
 
c++ exp 1 Suraj...pdf
c++ exp 1 Suraj...pdfc++ exp 1 Suraj...pdf
c++ exp 1 Suraj...pdfayush616992
 
Function recap
Function recapFunction recap
Function recapalish sha
 
C- Programming Assignment 4 solution
C- Programming Assignment 4 solutionC- Programming Assignment 4 solution
C- Programming Assignment 4 solutionAnimesh Chaturvedi
 
C programming(Part 1)
C programming(Part 1)C programming(Part 1)
C programming(Part 1)SURBHI SAROHA
 
Infix to Prefix (Conversion, Evaluation, Code)
Infix to Prefix (Conversion, Evaluation, Code)Infix to Prefix (Conversion, Evaluation, Code)
Infix to Prefix (Conversion, Evaluation, Code)Ahmed Khateeb
 
Programming in C (part 2)
Programming in C (part 2)Programming in C (part 2)
Programming in C (part 2)SURBHI SAROHA
 
3. user input and some basic problem
3. user input and some basic problem3. user input and some basic problem
3. user input and some basic problemAlamgir Hossain
 
C programming Lab 2
C programming Lab 2C programming Lab 2
C programming Lab 2Zaibi Gondal
 
C- Programming Assignment practice set 2 solutions
C- Programming Assignment practice set 2 solutionsC- Programming Assignment practice set 2 solutions
C- Programming Assignment practice set 2 solutionsAnimesh Chaturvedi
 
Types of function call
Types of function callTypes of function call
Types of function callArijitDhali
 

What's hot (20)

Expressions using operator in c
Expressions using operator in cExpressions using operator in c
Expressions using operator in c
 
C- Programming Assignment 3
C- Programming Assignment 3C- Programming Assignment 3
C- Programming Assignment 3
 
Decision making and branching
Decision making and branchingDecision making and branching
Decision making and branching
 
Programming fundamentals
Programming fundamentalsProgramming fundamentals
Programming fundamentals
 
Prefix Postfix
Prefix PostfixPrefix Postfix
Prefix Postfix
 
c++ exp 1 Suraj...pdf
c++ exp 1 Suraj...pdfc++ exp 1 Suraj...pdf
c++ exp 1 Suraj...pdf
 
Function recap
Function recapFunction recap
Function recap
 
C- Programming Assignment 4 solution
C- Programming Assignment 4 solutionC- Programming Assignment 4 solution
C- Programming Assignment 4 solution
 
C programming(Part 1)
C programming(Part 1)C programming(Part 1)
C programming(Part 1)
 
Pointers in C language
Pointers  in  C languagePointers  in  C language
Pointers in C language
 
Pointers
PointersPointers
Pointers
 
Function Pointer in C
Function Pointer in CFunction Pointer in C
Function Pointer in C
 
Infix to Prefix (Conversion, Evaluation, Code)
Infix to Prefix (Conversion, Evaluation, Code)Infix to Prefix (Conversion, Evaluation, Code)
Infix to Prefix (Conversion, Evaluation, Code)
 
Programming in C (part 2)
Programming in C (part 2)Programming in C (part 2)
Programming in C (part 2)
 
3. user input and some basic problem
3. user input and some basic problem3. user input and some basic problem
3. user input and some basic problem
 
Functions in c++,
Functions in c++,Functions in c++,
Functions in c++,
 
C programming Lab 2
C programming Lab 2C programming Lab 2
C programming Lab 2
 
C- Programming Assignment practice set 2 solutions
C- Programming Assignment practice set 2 solutionsC- Programming Assignment practice set 2 solutions
C- Programming Assignment practice set 2 solutions
 
Types of function call
Types of function callTypes of function call
Types of function call
 
Loop Statements [5] M
Loop Statements [5] MLoop Statements [5] M
Loop Statements [5] M
 

Similar to Pointer Experiment Report

Lecture 5Arrays on c++ for Beginner.pptx
Lecture 5Arrays on c++ for Beginner.pptxLecture 5Arrays on c++ for Beginner.pptx
Lecture 5Arrays on c++ for Beginner.pptxarjurakibulhasanrrr7
 
C++ Programming Homework Help
C++ Programming Homework HelpC++ Programming Homework Help
C++ Programming Homework HelpC++ Homework Help
 
VIT351 Software Development VI Unit2
VIT351 Software Development VI Unit2VIT351 Software Development VI Unit2
VIT351 Software Development VI Unit2YOGESH SINGH
 
Pointers in C Language
Pointers in C LanguagePointers in C Language
Pointers in C Languagemadan reddy
 
Assignment c programming
Assignment c programmingAssignment c programming
Assignment c programmingIcaii Infotech
 
The best every notes on c language is here check it out
The best every notes on c language is here check it outThe best every notes on c language is here check it out
The best every notes on c language is here check it outrajatryadav22
 
Engineering Computers L32-L33-Pointers.pptx
Engineering Computers L32-L33-Pointers.pptxEngineering Computers L32-L33-Pointers.pptx
Engineering Computers L32-L33-Pointers.pptxhappycocoman
 
Function in c program
Function in c programFunction in c program
Function in c programumesh patil
 
C and Data structure lab manual ECE (2).pdf
C and Data structure lab manual ECE (2).pdfC and Data structure lab manual ECE (2).pdf
C and Data structure lab manual ECE (2).pdfjanakim15
 
C_Lab Manual_Part A.docx
C_Lab Manual_Part A.docxC_Lab Manual_Part A.docx
C_Lab Manual_Part A.docxPandiya Rajan
 
Advanced Web Technology ass.pdf
Advanced Web Technology ass.pdfAdvanced Web Technology ass.pdf
Advanced Web Technology ass.pdfsimenehanmut
 

Similar to Pointer Experiment Report (20)

Python Manuel-R2021.pdf
Python Manuel-R2021.pdfPython Manuel-R2021.pdf
Python Manuel-R2021.pdf
 
C programming
C programmingC programming
C programming
 
Lecture 5Arrays on c++ for Beginner.pptx
Lecture 5Arrays on c++ for Beginner.pptxLecture 5Arrays on c++ for Beginner.pptx
Lecture 5Arrays on c++ for Beginner.pptx
 
C Programming Unit-4
C Programming Unit-4C Programming Unit-4
C Programming Unit-4
 
Ocs752 unit 3
Ocs752   unit 3Ocs752   unit 3
Ocs752 unit 3
 
C++ Programming Homework Help
C++ Programming Homework HelpC++ Programming Homework Help
C++ Programming Homework Help
 
VIT351 Software Development VI Unit2
VIT351 Software Development VI Unit2VIT351 Software Development VI Unit2
VIT351 Software Development VI Unit2
 
LMmanual.pdf
LMmanual.pdfLMmanual.pdf
LMmanual.pdf
 
Pointers in C Language
Pointers in C LanguagePointers in C Language
Pointers in C Language
 
Assignment c programming
Assignment c programmingAssignment c programming
Assignment c programming
 
U3.pptx
U3.pptxU3.pptx
U3.pptx
 
unit 3 ppt.pptx
unit 3 ppt.pptxunit 3 ppt.pptx
unit 3 ppt.pptx
 
The best every notes on c language is here check it out
The best every notes on c language is here check it outThe best every notes on c language is here check it out
The best every notes on c language is here check it out
 
Pointer in C
Pointer in CPointer in C
Pointer in C
 
Engineering Computers L32-L33-Pointers.pptx
Engineering Computers L32-L33-Pointers.pptxEngineering Computers L32-L33-Pointers.pptx
Engineering Computers L32-L33-Pointers.pptx
 
Function in c program
Function in c programFunction in c program
Function in c program
 
C and Data structure lab manual ECE (2).pdf
C and Data structure lab manual ECE (2).pdfC and Data structure lab manual ECE (2).pdf
C and Data structure lab manual ECE (2).pdf
 
C_Lab Manual_Part A.docx
C_Lab Manual_Part A.docxC_Lab Manual_Part A.docx
C_Lab Manual_Part A.docx
 
Advanced Web Technology ass.pdf
Advanced Web Technology ass.pdfAdvanced Web Technology ass.pdf
Advanced Web Technology ass.pdf
 
ch08.ppt
ch08.pptch08.ppt
ch08.ppt
 

Recently uploaded

CCS355 Neural Network & Deep Learning UNIT III notes and Question bank .pdf
CCS355 Neural Network & Deep Learning UNIT III notes and Question bank .pdfCCS355 Neural Network & Deep Learning UNIT III notes and Question bank .pdf
CCS355 Neural Network & Deep Learning UNIT III notes and Question bank .pdfAsst.prof M.Gokilavani
 
Call Girls Narol 7397865700 Independent Call Girls
Call Girls Narol 7397865700 Independent Call GirlsCall Girls Narol 7397865700 Independent Call Girls
Call Girls Narol 7397865700 Independent Call Girlsssuser7cb4ff
 
Study on Air-Water & Water-Water Heat Exchange in a Finned Tube Exchanger
Study on Air-Water & Water-Water Heat Exchange in a Finned Tube ExchangerStudy on Air-Water & Water-Water Heat Exchange in a Finned Tube Exchanger
Study on Air-Water & Water-Water Heat Exchange in a Finned Tube ExchangerAnamika Sarkar
 
Churning of Butter, Factors affecting .
Churning of Butter, Factors affecting  .Churning of Butter, Factors affecting  .
Churning of Butter, Factors affecting .Satyam Kumar
 
HARMONY IN THE NATURE AND EXISTENCE - Unit-IV
HARMONY IN THE NATURE AND EXISTENCE - Unit-IVHARMONY IN THE NATURE AND EXISTENCE - Unit-IV
HARMONY IN THE NATURE AND EXISTENCE - Unit-IVRajaP95
 
Architect Hassan Khalil Portfolio for 2024
Architect Hassan Khalil Portfolio for 2024Architect Hassan Khalil Portfolio for 2024
Architect Hassan Khalil Portfolio for 2024hassan khalil
 
Microscopic Analysis of Ceramic Materials.pptx
Microscopic Analysis of Ceramic Materials.pptxMicroscopic Analysis of Ceramic Materials.pptx
Microscopic Analysis of Ceramic Materials.pptxpurnimasatapathy1234
 
Electronically Controlled suspensions system .pdf
Electronically Controlled suspensions system .pdfElectronically Controlled suspensions system .pdf
Electronically Controlled suspensions system .pdfme23b1001
 
main PPT.pptx of girls hostel security using rfid
main PPT.pptx of girls hostel security using rfidmain PPT.pptx of girls hostel security using rfid
main PPT.pptx of girls hostel security using rfidNikhilNagaraju
 
CCS355 Neural Network & Deep Learning Unit II Notes with Question bank .pdf
CCS355 Neural Network & Deep Learning Unit II Notes with Question bank .pdfCCS355 Neural Network & Deep Learning Unit II Notes with Question bank .pdf
CCS355 Neural Network & Deep Learning Unit II Notes with Question bank .pdfAsst.prof M.Gokilavani
 
Concrete Mix Design - IS 10262-2019 - .pptx
Concrete Mix Design - IS 10262-2019 - .pptxConcrete Mix Design - IS 10262-2019 - .pptx
Concrete Mix Design - IS 10262-2019 - .pptxKartikeyaDwivedi3
 
chaitra-1.pptx fake news detection using machine learning
chaitra-1.pptx  fake news detection using machine learningchaitra-1.pptx  fake news detection using machine learning
chaitra-1.pptx fake news detection using machine learningmisbanausheenparvam
 
IVE Industry Focused Event - Defence Sector 2024
IVE Industry Focused Event - Defence Sector 2024IVE Industry Focused Event - Defence Sector 2024
IVE Industry Focused Event - Defence Sector 2024Mark Billinghurst
 
GDSC ASEB Gen AI study jams presentation
GDSC ASEB Gen AI study jams presentationGDSC ASEB Gen AI study jams presentation
GDSC ASEB Gen AI study jams presentationGDSCAESB
 
Biology for Computer Engineers Course Handout.pptx
Biology for Computer Engineers Course Handout.pptxBiology for Computer Engineers Course Handout.pptx
Biology for Computer Engineers Course Handout.pptxDeepakSakkari2
 
Introduction-To-Agricultural-Surveillance-Rover.pptx
Introduction-To-Agricultural-Surveillance-Rover.pptxIntroduction-To-Agricultural-Surveillance-Rover.pptx
Introduction-To-Agricultural-Surveillance-Rover.pptxk795866
 
Software and Systems Engineering Standards: Verification and Validation of Sy...
Software and Systems Engineering Standards: Verification and Validation of Sy...Software and Systems Engineering Standards: Verification and Validation of Sy...
Software and Systems Engineering Standards: Verification and Validation of Sy...VICTOR MAESTRE RAMIREZ
 

Recently uploaded (20)

CCS355 Neural Network & Deep Learning UNIT III notes and Question bank .pdf
CCS355 Neural Network & Deep Learning UNIT III notes and Question bank .pdfCCS355 Neural Network & Deep Learning UNIT III notes and Question bank .pdf
CCS355 Neural Network & Deep Learning UNIT III notes and Question bank .pdf
 
Call Girls Narol 7397865700 Independent Call Girls
Call Girls Narol 7397865700 Independent Call GirlsCall Girls Narol 7397865700 Independent Call Girls
Call Girls Narol 7397865700 Independent Call Girls
 
Study on Air-Water & Water-Water Heat Exchange in a Finned Tube Exchanger
Study on Air-Water & Water-Water Heat Exchange in a Finned Tube ExchangerStudy on Air-Water & Water-Water Heat Exchange in a Finned Tube Exchanger
Study on Air-Water & Water-Water Heat Exchange in a Finned Tube Exchanger
 
Exploring_Network_Security_with_JA3_by_Rakesh Seal.pptx
Exploring_Network_Security_with_JA3_by_Rakesh Seal.pptxExploring_Network_Security_with_JA3_by_Rakesh Seal.pptx
Exploring_Network_Security_with_JA3_by_Rakesh Seal.pptx
 
Churning of Butter, Factors affecting .
Churning of Butter, Factors affecting  .Churning of Butter, Factors affecting  .
Churning of Butter, Factors affecting .
 
HARMONY IN THE NATURE AND EXISTENCE - Unit-IV
HARMONY IN THE NATURE AND EXISTENCE - Unit-IVHARMONY IN THE NATURE AND EXISTENCE - Unit-IV
HARMONY IN THE NATURE AND EXISTENCE - Unit-IV
 
Architect Hassan Khalil Portfolio for 2024
Architect Hassan Khalil Portfolio for 2024Architect Hassan Khalil Portfolio for 2024
Architect Hassan Khalil Portfolio for 2024
 
Microscopic Analysis of Ceramic Materials.pptx
Microscopic Analysis of Ceramic Materials.pptxMicroscopic Analysis of Ceramic Materials.pptx
Microscopic Analysis of Ceramic Materials.pptx
 
Electronically Controlled suspensions system .pdf
Electronically Controlled suspensions system .pdfElectronically Controlled suspensions system .pdf
Electronically Controlled suspensions system .pdf
 
Call Us -/9953056974- Call Girls In Vikaspuri-/- Delhi NCR
Call Us -/9953056974- Call Girls In Vikaspuri-/- Delhi NCRCall Us -/9953056974- Call Girls In Vikaspuri-/- Delhi NCR
Call Us -/9953056974- Call Girls In Vikaspuri-/- Delhi NCR
 
main PPT.pptx of girls hostel security using rfid
main PPT.pptx of girls hostel security using rfidmain PPT.pptx of girls hostel security using rfid
main PPT.pptx of girls hostel security using rfid
 
CCS355 Neural Network & Deep Learning Unit II Notes with Question bank .pdf
CCS355 Neural Network & Deep Learning Unit II Notes with Question bank .pdfCCS355 Neural Network & Deep Learning Unit II Notes with Question bank .pdf
CCS355 Neural Network & Deep Learning Unit II Notes with Question bank .pdf
 
Concrete Mix Design - IS 10262-2019 - .pptx
Concrete Mix Design - IS 10262-2019 - .pptxConcrete Mix Design - IS 10262-2019 - .pptx
Concrete Mix Design - IS 10262-2019 - .pptx
 
chaitra-1.pptx fake news detection using machine learning
chaitra-1.pptx  fake news detection using machine learningchaitra-1.pptx  fake news detection using machine learning
chaitra-1.pptx fake news detection using machine learning
 
IVE Industry Focused Event - Defence Sector 2024
IVE Industry Focused Event - Defence Sector 2024IVE Industry Focused Event - Defence Sector 2024
IVE Industry Focused Event - Defence Sector 2024
 
GDSC ASEB Gen AI study jams presentation
GDSC ASEB Gen AI study jams presentationGDSC ASEB Gen AI study jams presentation
GDSC ASEB Gen AI study jams presentation
 
Biology for Computer Engineers Course Handout.pptx
Biology for Computer Engineers Course Handout.pptxBiology for Computer Engineers Course Handout.pptx
Biology for Computer Engineers Course Handout.pptx
 
Introduction-To-Agricultural-Surveillance-Rover.pptx
Introduction-To-Agricultural-Surveillance-Rover.pptxIntroduction-To-Agricultural-Surveillance-Rover.pptx
Introduction-To-Agricultural-Surveillance-Rover.pptx
 
young call girls in Green Park🔝 9953056974 🔝 escort Service
young call girls in Green Park🔝 9953056974 🔝 escort Serviceyoung call girls in Green Park🔝 9953056974 🔝 escort Service
young call girls in Green Park🔝 9953056974 🔝 escort Service
 
Software and Systems Engineering Standards: Verification and Validation of Sy...
Software and Systems Engineering Standards: Verification and Validation of Sy...Software and Systems Engineering Standards: Verification and Validation of Sy...
Software and Systems Engineering Standards: Verification and Validation of Sy...
 

Pointer Experiment Report

  • 1. SUBJECT NAME-Fundamentalsof ComputerProgramming SUBJECT CODE-21CSH101 STUDENT’S NAME –Ankita Sharma STUDENT’S UID – 21BCS2219 CLASS AND GROUP –13A SEMESTER –1 EXPERIMENT NUMBER – 3.1 AIM OF THE EXPERIMENT– To LEARN HOW TO USE POINTERS IN C A) WAP to read an array of elements and print the same in the reverse order along with their addresses using pointer. B)WAP to read an array of elements and print the same in the reverse order along with their addresses using pointer. FLOWCHART/ALGORITHM- A) STEP 1: START o STEP 2: INITIALIZE arr[] = { } o STEP 3: length= sizeof(arr)/sizeof(arr[0]) o STEP 4: PRINT "Original Array:" o STEP 5: REPEAT STEP 6 and STEP 7 UNTIL i<length o STEP 6: PRINT arr[i] o STEP 7: i=i+1 o STEP 8: PRINT new line. o STEP 9: PRINT "Array in reverse order" o STEP 10: SET i=length-1. REPEAT STEP 11 and STEP 12 UNTIL i>=0 o STEP 11: PRINT a[i] o STEP 12: i=i-1 o STEP 13: RETURN 0. o STEP 14: END B)
  • 2. SUBJECT NAME-Fundamentalsof ComputerProgramming SUBJECT CODE-21CSH101 Step 1: START Step 2: declare a function Step 3: declare integer variables Step 4: enter two comparable values Step 5: then enter pointer variables to store the values Step 6: then define the function Step 7: if the value pointed by pointer m is greater than it return the address stored in pointer n Step 8: else it will return the address stored in pointer n Step 9: end PROGRAM CODE #include <stdio.h> int main() { int n, i, arr1[15]; int *pt; printf("nn Pointer : Print the elements of an array in reverse order :n"); printf(" Input the number of elements to store in the array (max 15) :n "); scanf("%d",&n); pt = &arr1[0]; printf(" Input %d number of elements in the array : n",n); for(i=0;i<n;i++) { printf(" element - %d : ",i+1); scanf("%d",pt); pt++; } pt = &arr1[n - 1]; printf("n The elements of array in reverse order are :"); for (i = n; i > 0; i--) { printf("n element - %d : %d ", i, *pt); pt--; } printf("nn");
  • 3. SUBJECT NAME-Fundamentalsof ComputerProgramming SUBJECT CODE-21CSH101 return 0; } B) #include <stdio.h> int *getMax(int *, int *); int main(void) { int x, y; printf(" FIND MAX VALUEn Enter two integers-n "); scanf("%d%d", &x,&y); int *max = NULL; max = getMax(&x, &y); printf(" Max value: %dn", *max); return 0; } int *getMax(int *m, int *n) { if (*m > *n) { return m; } else { return n; } } ERRORS ENCOUNTERED DURING PROGRAM’S EXECUTION (Kindly jot down the compile time errors encountered) No errors encountered.
  • 4. SUBJECT NAME-Fundamentalsof ComputerProgramming SUBJECT CODE-21CSH101 PROGRAMS’ EXPLANATION (in brief) In program(A), we need to print the elements of the array in reverse order that is; the last element should be displayed first, followed by second last element and so on. B) Since the name of an array is a pointer to the 0th element of the array. Here we are passing two arguments to the function return_pointer(). The arr is passed using call by reference (notice that name of the array is not preceded by & operator because the name of the array is a constant pointer to the 0th element of the 1-D array) and i is passed using call by value. Inside the function pointer p is incremented by n and reassigned to p. Finally, the pointer p is returned to the main() function and reassigned to ptr. Never return a pointer to local variable from a function. OUTPUT
  • 6. SUBJECT NAME-Fundamentalsof ComputerProgramming SUBJECT CODE-21CSH101 LEARNING OUTCOMES  Remember the concepts related to fundamentals of C language, draw flowcharts and write algorithm/pseudocode.  Understand the way of execution and debug programs in C language.  Apply various constructs, loops, functions to solve mathematical and scientific problem.  Analyze the dynamic behavior of memory by the use of pointers.  Design and develop modular programs for real world problems using control structure and selection structure. EVALUATION COLUMN (To be filled by concerned faculty only) Sr. No. Parameters Maximum Marks Marks Obtained 1. Worksheet Completion including writing learning objective/ Outcome 10 2. Post-Lab Quiz Result 5 3. Student engagement in Simulation/ Performance/ Pre-Lab Questions 5 4. Total Marks 20