473,511 Members | 9,908 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

linear search

1 New Member
what is parse error?




#include<stdio.h>
#include<conio.h>
void main()
{
int i,a[30],key;
clrscr();
printf("enter array elements:\n");
for(i=0;i<5;i++)
{
scanf("%d",&a[i]);
}
print("the elements of array:\n");
for(i=0;i<5;i++)
{
printf("%d",a[i]);
}
printf("enter key element to search");
scanf("%d",&key);
for(i=0;i<5;i++)
{
if(a[i]==key)
{
printf("key found a[%d]",i);
break;
}
if(i==5)
printf("key not found");
getch();
}
Apr 21 '15 #1
1 1673
weaknessforcats
9,208 Recognized Expert Moderator Expert
This code:

Expand|Select|Wrap|Line Numbers
  1. print("the elements of array:\n");
needs to be printf.

You also need a closing brace on main().
Apr 21 '15 #2

Sign in to post your reply or Sign up for a free account.

Similar topics

28
3126
by: joshc | last post by:
If I have an array of data that I know to be sorted in increasing order, and the array is less than 50 elements, and I want to find the first element greater than a certain value, is a simple...
2
3938
by: littlegirl | last post by:
hi guys can some one help me here i have to accept a number and preform a linear search for the numbers and if its not one of the number it has to say its invalid #include <iostream> using...
9
3125
by: Rick | last post by:
I have a large list of objects where each object has a unique (non-overlapping) date range. The list is sorted chronologically. What is the most efficient way to search this list for a single...
2
7244
by: sturgeob | last post by:
Yep. Newby. I am asked to find the closest value to user defined value if not right on the mark. I can get it to determin it I have selected one of the generated numbers, but am at a loss how to...
1
1656
by: geebanga88 | last post by:
HI i have a method that performs a linear search to find a given vowel. The vowel parameter is a given vowel, while vowel is the array with all the vowels. public static void...
26
2552
by: mike-yue | last post by:
The topic comes from a question: Would you rather wait for the results of a quicksort, a linear search, or a bubble sort on a 200000 element array? 1Quicksort 2Linear Search 3Bubble Sort ...
3
1838
by: nembo kid | last post by:
I have an issue with a simple function that has to make a linear search for a key into an array. If the key is found in the array, the function it has to return 1 to the caller and pass array...
6
12127
Kelicula
by: Kelicula | last post by:
Why?: One commonly used algorithm is the binary search. If you don't already know it, you should read on. Very helpful. Saves much CPU. Reduces computations exponentially. When searching...
0
7148
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can...
0
7367
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers,...
0
7430
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven...
0
5673
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing,...
1
5072
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome a new...
0
4743
by: conductexam | last post by:
I have .net C# application in which I am extracting data from word file and save it in database particularly. To store word all data as it is I am converting the whole word file firstly in HTML and...
0
3230
by: TSSRALBI | last post by:
Hello I'm a network technician in training and I need your help. I am currently learning how to create and manage the different types of VPNs and I have a question about LAN-to-LAN VPNs. The...
0
3217
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
1
790
muto222
by: muto222 | last post by:
How can i add a mobile payment intergratation into php mysql website.

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.