Click here to Skip to main content
15,899,313 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
See more:
C++
void maxarea(int tarr[],int count)
 {
     int i,p,j;
     p=tarr[0]*tarr[1];
     for(i=0;i<count;i++)
     {
         for(j=i+1;j<count;j++)
         {
             if((tarr[i]*tarr[j])>p)
                p=tarr[i]*tarr[j];
         }
     }
    printf("%d",p);
 }




This function above is for calculating the maximum product possible of array elemets ,the array being passed to the function

NOW THE ERROR ACCORDING TO CODE BLOCKS IS AT THE END BRACE OF THE FUNCTION WHICH SAYS
expected '=',',',';','asm' or '_attribute_' at the end of input
PLS HELP

What I have tried:

i don't know what's going wrong with the function plzz help me out to remove the error
Posted
Updated 18-Jul-16 9:51am
v3
Comments
Richard MacCutchan 18-Jul-16 10:32am    
What are those > signs at the end of your for statements supposed to do?
Patrice T 18-Jul-16 15:42pm    
The > are CP artifacts because when it sees a <, it try to make it an xml tag
look at source code with includes, if it was not in pre tags, it make closing tags at the end.
Richard MacCutchan 19-Jul-16 3:04am    
It normally does not do it inside <pre> tags; I post and edit code snippets here every day.
Patrice T 19-Jul-16 3:30am    
The tag was forgotten by OP when posted question, OriginalGriff put it after.

Don't assume it's in that code: it may well be that a function above that has an unmatched bracket that is causing the compiler to give you the error at the end of the file.
Many IDE's use CTRL+{ / CTRL+[ or CTRL+} / CTRL+] to "jump" to the matching close bracket if you position the input at an open bracket - give it a try and see if any of your brackets are missing or spurious.
 
Share this answer
 
v2
Comments
Patrice T 18-Jul-16 15:52pm    
5ed
Patrice T 18-Jul-16 15:52pm    
5ed
I see nothing obvious in this code snipset.
Use editor features:
- use re-indentation to see if something appears.
- use parentheses matching to see where is the closing parenthesis for an opening one.
- comment out some pieces of your code to see the effect on the error message.
 
Share this answer
 

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900