Search:
Forum
General C++ Programming
Error: 1d return 1 Exit Status
Error: 1d return 1 Exit Status
Apr 28, 2018 at 2:33pm UTC
adil12345
(3)
#include <iostream>
using namespace std;
int frequency(int a[], int n, int x)
{
int count = 0;
for (int i = 0; i < n; i++)
{
if (a[i] == x)
count++;
return count;
}
int main();
{
int a[] = { 0, 6, 7, 8, 4 };
int n = 5;
int x = sizeof(a) / sizeof(a[0]);
cout << frequency(a, x, n);
return 0;
}
system("pause");
}
Write your question here.
Apr 28, 2018 at 3:00pm UTC
Peter87
(11237)
you have put the code for main() inside the frequency function.
You need to move main() outside the frequency function and remove the semicolon after main().
Apr 28, 2018 at 4:03pm UTC
adil12345
(3)
Thanks :)
Topic archived. No new replies allowed.
C++
Information
Tutorials
Reference
Articles
Forum
Forum
Beginners
Windows Programming
UNIX/Linux Programming
General C++ Programming
Lounge
Jobs