SlideShare a Scribd company logo
S9-1
Write a program in ‘C’ language to implement linear search using pointers.
# include<stdio.h>
main()
{
int arr[20],*p, n,i,item;
clrscr();
printf("How many elements you want to enter in the array : ");
scanf("%d",&n);
for(i=0; i < n;i++)
{
printf("Enter element %d : ",i+1);
scanf("%d", &arr[i]);
}
printf("Enter the element to be searched : ");
scanf("%d",&item);
p=arr;
for(i=0;i < n;i++)
{
if(item == *p)
{
printf("%d found at position %dn",item,i+1);
break;
}
p++;
}/*End of for*/
if(i == n)
printf("Item %d not found in arrayn",item);
getch();
}
Page 1

More Related Content

What's hot (20)

PPTX
self_refrential_structures.pptx
AshishNayyar12
 
PDF
Python exception handling
Mohammed Sikander
 
PPT
Class and object in C++
rprajat007
 
PPT
Cpu organisation
Er Sangita Vishwakarma
 
PDF
VTU Data Structures Lab Manual
Nithin Kumar,VVCE, Mysuru
 
PPTX
BRESENHAM’S LINE DRAWING ALGORITHM
St Mary's College,Thrissur,Kerala
 
PPTX
Presentation on Function in C Programming
Shuvongkor Barman
 
PPTX
Projection of points
Suraj Meshram
 
PPTX
Sorting algorithms
Trupti Agrawal
 
PDF
C programming notes.pdf
AdiseshaK
 
PPTX
Graph traversals in Data Structures
Anandhasilambarasan D
 
PPTX
Data structure and its types.
buyinstagramfollowersaustralia
 
PPTX
C Programming Unit-5
Vikram Nandini
 
PPTX
Fulll Adder
Muhammad Yasir
 
PPT
Digital Logic Design
Vaagdevi College of Engineering
 
PPTX
flip flops
Unsa Shakir
 
PPTX
Control statements in c
Sathish Narayanan
 
PDF
Python for class 11 (CBSE Computer science sub code 083)
Nitin Kumar
 
PPTX
Register in Digital Logic
ISMT College
 
self_refrential_structures.pptx
AshishNayyar12
 
Python exception handling
Mohammed Sikander
 
Class and object in C++
rprajat007
 
Cpu organisation
Er Sangita Vishwakarma
 
VTU Data Structures Lab Manual
Nithin Kumar,VVCE, Mysuru
 
BRESENHAM’S LINE DRAWING ALGORITHM
St Mary's College,Thrissur,Kerala
 
Presentation on Function in C Programming
Shuvongkor Barman
 
Projection of points
Suraj Meshram
 
Sorting algorithms
Trupti Agrawal
 
C programming notes.pdf
AdiseshaK
 
Graph traversals in Data Structures
Anandhasilambarasan D
 
Data structure and its types.
buyinstagramfollowersaustralia
 
C Programming Unit-5
Vikram Nandini
 
Fulll Adder
Muhammad Yasir
 
Digital Logic Design
Vaagdevi College of Engineering
 
flip flops
Unsa Shakir
 
Control statements in c
Sathish Narayanan
 
Python for class 11 (CBSE Computer science sub code 083)
Nitin Kumar
 
Register in Digital Logic
ISMT College
 

Viewers also liked (20)

PDF
9 virtual memory management
Dr. Loganathan R
 
PDF
8 memory management strategies
Dr. Loganathan R
 
PDF
Implement a queue using two stacks.
Dr. Loganathan R
 
PDF
Bcsl 033 data and file structures lab s5-3
Dr. Loganathan R
 
PPS
Ways To Enjoy Work
Sreenath S
 
PPSX
The Old Lady’S Bet [Joke]!!
Sreenath S
 
PPSX
Hitler
Sreenath S
 
PPT
See The Funny, Reflect Wisely
OH TEIK BIN
 
PPT
Story of Success and Creativity
John Daniel
 
PPS
Ten things god won't ask on that day
Ajay Kumar Gupta
 
PPS
Friend
Sreenath S
 
PPS
3 Things In Life
Sreenath S
 
PPSX
Team Work [Story]
Sreenath S
 
PPS
A good marketing joke for you
Ajay Kumar Gupta
 
PPS
Learn About Numbers [Interesting]
Sreenath S
 
PPS
Laughter For Good Health
OH TEIK BIN
 
PPTX
Secondary storage structure
Priya Selvaraj
 
PPT
"Spreading Humor, Sharing Wisdom"
OH TEIK BIN
 
PPT
Secondary storage structure-Operating System Concepts
Arjun Kaimattathil
 
9 virtual memory management
Dr. Loganathan R
 
8 memory management strategies
Dr. Loganathan R
 
Implement a queue using two stacks.
Dr. Loganathan R
 
Bcsl 033 data and file structures lab s5-3
Dr. Loganathan R
 
Ways To Enjoy Work
Sreenath S
 
The Old Lady’S Bet [Joke]!!
Sreenath S
 
Hitler
Sreenath S
 
See The Funny, Reflect Wisely
OH TEIK BIN
 
Story of Success and Creativity
John Daniel
 
Ten things god won't ask on that day
Ajay Kumar Gupta
 
Friend
Sreenath S
 
3 Things In Life
Sreenath S
 
Team Work [Story]
Sreenath S
 
A good marketing joke for you
Ajay Kumar Gupta
 
Learn About Numbers [Interesting]
Sreenath S
 
Laughter For Good Health
OH TEIK BIN
 
Secondary storage structure
Priya Selvaraj
 
"Spreading Humor, Sharing Wisdom"
OH TEIK BIN
 
Secondary storage structure-Operating System Concepts
Arjun Kaimattathil
 
Ad

More from Dr. Loganathan R (20)

PDF
Ch 6 IoT Processing Topologies and Types.pdf
Dr. Loganathan R
 
PDF
IoT Sensing and Actuation.pdf
Dr. Loganathan R
 
PDF
Ch 4 Emergence of IoT.pdf
Dr. Loganathan R
 
PDF
Bcsl 033 data and file structures lab s5-2
Dr. Loganathan R
 
PDF
Bcsl 033 data and file structures lab s4-3
Dr. Loganathan R
 
PDF
Bcsl 033 data and file structures lab s4-2
Dr. Loganathan R
 
PDF
Bcsl 033 data and file structures lab s3-3
Dr. Loganathan R
 
PDF
Bcsl 033 data and file structures lab s3-2
Dr. Loganathan R
 
PDF
Bcsl 033 data and file structures lab s3-1
Dr. Loganathan R
 
PDF
Bcsl 033 data and file structures lab s2-3
Dr. Loganathan R
 
PDF
Bcsl 033 data and file structures lab s2-2
Dr. Loganathan R
 
PDF
Bcsl 033 data and file structures lab s2-1
Dr. Loganathan R
 
PDF
Bcsl 033 data and file structures lab s1-4
Dr. Loganathan R
 
PDF
Bcsl 033 data and file structures lab s1-3
Dr. Loganathan R
 
PDF
Bcsl 033 data and file structures lab s1-2
Dr. Loganathan R
 
PDF
Bcsl 033 data and file structures lab s1-1
Dr. Loganathan R
 
PPT
Introduction to Information Security
Dr. Loganathan R
 
PDF
Mcs 012 computer organisation and assemly language programming- ignou assignm...
Dr. Loganathan R
 
PDF
Session 9 4 alp to display the current system time using dos int 21 h
Dr. Loganathan R
 
PDF
Session 9 1 alp to compute a grade using procedures
Dr. Loganathan R
 
Ch 6 IoT Processing Topologies and Types.pdf
Dr. Loganathan R
 
IoT Sensing and Actuation.pdf
Dr. Loganathan R
 
Ch 4 Emergence of IoT.pdf
Dr. Loganathan R
 
Bcsl 033 data and file structures lab s5-2
Dr. Loganathan R
 
Bcsl 033 data and file structures lab s4-3
Dr. Loganathan R
 
Bcsl 033 data and file structures lab s4-2
Dr. Loganathan R
 
Bcsl 033 data and file structures lab s3-3
Dr. Loganathan R
 
Bcsl 033 data and file structures lab s3-2
Dr. Loganathan R
 
Bcsl 033 data and file structures lab s3-1
Dr. Loganathan R
 
Bcsl 033 data and file structures lab s2-3
Dr. Loganathan R
 
Bcsl 033 data and file structures lab s2-2
Dr. Loganathan R
 
Bcsl 033 data and file structures lab s2-1
Dr. Loganathan R
 
Bcsl 033 data and file structures lab s1-4
Dr. Loganathan R
 
Bcsl 033 data and file structures lab s1-3
Dr. Loganathan R
 
Bcsl 033 data and file structures lab s1-2
Dr. Loganathan R
 
Bcsl 033 data and file structures lab s1-1
Dr. Loganathan R
 
Introduction to Information Security
Dr. Loganathan R
 
Mcs 012 computer organisation and assemly language programming- ignou assignm...
Dr. Loganathan R
 
Session 9 4 alp to display the current system time using dos int 21 h
Dr. Loganathan R
 
Session 9 1 alp to compute a grade using procedures
Dr. Loganathan R
 
Ad

Recently uploaded (20)

PPTX
Universal immunization Programme (UIP).pptx
Vishal Chanalia
 
PDF
Women's Health: Essential Tips for Every Stage.pdf
Iftikhar Ahmed
 
PDF
The Different Types of Non-Experimental Research
Thelma Villaflores
 
PPTX
How to Set Maximum Difference Odoo 18 POS
Celine George
 
PDF
CONCURSO DE POESIA “POETUFAS – PASSOS SUAVES PELO VERSO.pdf
Colégio Santa Teresinha
 
PDF
Reconstruct, Restore, Reimagine: New Perspectives on Stoke Newington’s Histor...
History of Stoke Newington
 
PDF
Biological Bilingual Glossary Hindi and English Medium
World of Wisdom
 
PDF
ARAL_Orientation_Day-2-Sessions_ARAL-Readung ARAL-Mathematics ARAL-Sciencev2.pdf
JoelVilloso1
 
PPTX
SPINA BIFIDA: NURSING MANAGEMENT .pptx
PRADEEP ABOTHU
 
PDF
The Constitution Review Committee (CRC) has released an updated schedule for ...
nservice241
 
PPTX
How to Convert an Opportunity into a Quotation in Odoo 18 CRM
Celine George
 
PPTX
ASRB NET 2023 PREVIOUS YEAR QUESTION PAPER GENETICS AND PLANT BREEDING BY SAT...
Krashi Coaching
 
PDF
Stokey: A Jewish Village by Rachel Kolsky
History of Stoke Newington
 
PPTX
CATEGORIES OF NURSING PERSONNEL: HOSPITAL & COLLEGE
PRADEEP ABOTHU
 
PPTX
How to Handle Salesperson Commision in Odoo 18 Sales
Celine George
 
PPTX
How to Set Up Tags in Odoo 18 - Odoo Slides
Celine George
 
PDF
Lesson 2 - WATER,pH, BUFFERS, AND ACID-BASE.pdf
marvinnbustamante1
 
PPTX
grade 5 lesson matatag ENGLISH 5_Q1_PPT_WEEK4.pptx
SireQuinn
 
PPTX
Cultivation practice of Litchi in Nepal.pptx
UmeshTimilsina1
 
PPTX
How to Create a PDF Report in Odoo 18 - Odoo Slides
Celine George
 
Universal immunization Programme (UIP).pptx
Vishal Chanalia
 
Women's Health: Essential Tips for Every Stage.pdf
Iftikhar Ahmed
 
The Different Types of Non-Experimental Research
Thelma Villaflores
 
How to Set Maximum Difference Odoo 18 POS
Celine George
 
CONCURSO DE POESIA “POETUFAS – PASSOS SUAVES PELO VERSO.pdf
Colégio Santa Teresinha
 
Reconstruct, Restore, Reimagine: New Perspectives on Stoke Newington’s Histor...
History of Stoke Newington
 
Biological Bilingual Glossary Hindi and English Medium
World of Wisdom
 
ARAL_Orientation_Day-2-Sessions_ARAL-Readung ARAL-Mathematics ARAL-Sciencev2.pdf
JoelVilloso1
 
SPINA BIFIDA: NURSING MANAGEMENT .pptx
PRADEEP ABOTHU
 
The Constitution Review Committee (CRC) has released an updated schedule for ...
nservice241
 
How to Convert an Opportunity into a Quotation in Odoo 18 CRM
Celine George
 
ASRB NET 2023 PREVIOUS YEAR QUESTION PAPER GENETICS AND PLANT BREEDING BY SAT...
Krashi Coaching
 
Stokey: A Jewish Village by Rachel Kolsky
History of Stoke Newington
 
CATEGORIES OF NURSING PERSONNEL: HOSPITAL & COLLEGE
PRADEEP ABOTHU
 
How to Handle Salesperson Commision in Odoo 18 Sales
Celine George
 
How to Set Up Tags in Odoo 18 - Odoo Slides
Celine George
 
Lesson 2 - WATER,pH, BUFFERS, AND ACID-BASE.pdf
marvinnbustamante1
 
grade 5 lesson matatag ENGLISH 5_Q1_PPT_WEEK4.pptx
SireQuinn
 
Cultivation practice of Litchi in Nepal.pptx
UmeshTimilsina1
 
How to Create a PDF Report in Odoo 18 - Odoo Slides
Celine George
 

Program in ‘C’ language to implement linear search using pointers

  • 1. S9-1 Write a program in ‘C’ language to implement linear search using pointers. # include<stdio.h> main() { int arr[20],*p, n,i,item; clrscr(); printf("How many elements you want to enter in the array : "); scanf("%d",&n); for(i=0; i < n;i++) { printf("Enter element %d : ",i+1); scanf("%d", &arr[i]); } printf("Enter the element to be searched : "); scanf("%d",&item); p=arr; for(i=0;i < n;i++) { if(item == *p) { printf("%d found at position %dn",item,i+1); break; } p++; }/*End of for*/ if(i == n) printf("Item %d not found in arrayn",item); getch(); } Page 1