467,915 Members | 1,147 Online
Bytes | Developer Community
New Post

Home Posts Topics Members FAQ

Post your question to a community of 467,915 developers. It's quick & easy.

linear search

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
  • viewed: 1295
Share:
1 Reply
weaknessforcats
Expert Mod 8TB
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

Post your reply

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

Similar topics

28 posts views Thread by joshc | last post: by
2 posts views Thread by littlegirl | last post: by
3 posts views Thread by nembo kid | last post: by
By using this site, you agree to our Privacy Policy and Terms of Use.