Expected a decleration and missing a (

602 views function
6

When I ran this, it gives me the errors you see on the image. Can someone help me on what am I doing wrong here?

int n = 2;
int const p = 8;
int e = 1;
int i = 1;

int pow ();
    {
        for (i = 1; i <= p; i++)
        {
            e = i * n;
            if (e == 0)
            {
                return 1;
            }
            else
            {
                if (e = > 1)
                {
                    cout << e << endl;
                }
            }
        }
    }

I get the error:

E0169 expected a decleration
C2447 '{': missing function header (old-style formal list?)

answered question

Is it the semicolon after int pow () ?

1 Answer

4

The error is because of the semicolon after pow() function

it should be

int pow ()
{

instead of

int pow ();
{

posted this

Have an answer?

JD

Please login first before posting an answer.