question on function and passing it an array

Collapse
X
 
  • Time
  • Show
Clear All
new posts
  • gdarian216
    New Member
    • Oct 2006
    • 57

    question on function and passing it an array

    question on function and passing it an array
    this is what i have so far and im getting errors.....


    Code:
     int dup_mark(int a, int b[]);
    
     int scores[20];
     int value;
    
    
    
       cout << "Enter list: ";
    
    int i;
       for( i = 0; i < 20; i++) {
               cin >> value;
               if(value == 0) {
                        break;
               }
               scores[i] = value;
            }
               int n = i; //save i because that is the number of process we need.
    
            //getting input is done
    
            dup_mark(n,scores[]);
    
    int dup_mark(int a, int b[])
    {
    
     for(int dup_loop = 0;dup_loop < a; ++dup_loop)
            {
            for(int dup2 = dup_loop+1; dup2 < a; ++dup2)
            {
            if (b[dup2] == b[dup_loop])
            {
                b[dup2] = 0;
            }
            }}}
    if anyone can help I would appreciate it
  • horace1
    Recognized Expert Top Contributor
    • Nov 2006
    • 1510

    #2
    when you call the function
    Code:
            //getting input is done
            dup_mark(n,scores[]);
    you don't need the [], e.g.
    Code:
            //getting input is done
            dup_mark(n,scores);

    Comment

    Working...