identifier problem

This is a discussion on identifier problem within the C++ Programming forums, part of the General Programming Boards category; Hi, I don't know why it shows the error of identifier 'a'. It is a parameter only. Any advice? Thanks ...

  1. #1
    Registered User
    Join Date
    Oct 2001
    Posts
    81

    Post identifier problem

    Hi,

    I don't know why it shows the error of identifier 'a'. It is a parameter only.

    Any advice?

    Thanks

    gogo


    #include <stdio.h>

    int* sort(int a[], int element)
    {
    int i=0, j=0, temp;

    while(i < (element - 1) )
    {
    j = i + 1;
    while(j < element)
    {
    if a[i] > a[j]
    {
    temp = a[i];
    a[i] = a[j];
    a[j] = temp;
    }
    j++;
    }
    i++;
    }
    }

    void main()
    {
    int q[]={12, 99, 58, 43, 39, 82, 22, 57, 31, 53, 92};
    int p;

    for(p=0; p<11; p++)
    printf(" %d ", q[p]);

    sort(q, 11);

    for(p=0; p<11; p++)
    printf(" %d ", q[p]);
    }

  2. #2
    Unregistered
    Guest
    if a[i] > a[j]

    should be

    if(a[i] > a[j])

  3. #3
    Registered User
    Join Date
    Oct 2001
    Posts
    81
    Thanks a lot. I made this mistake twice today.

    gogo

Popular pages Recent additions subscribe to a feed

Similar Threads

  1. Replies: 6
    Last Post: 09-27-2007, 08:17 AM
  2. Someone having same problem with Code Block?
    By ofayto in forum C++ Programming
    Replies: 1
    Last Post: 07-12-2007, 09:38 AM
  3. A question related to strcmp
    By meili100 in forum C++ Programming
    Replies: 6
    Last Post: 07-07-2007, 03:51 PM
  4. WS_POPUP, continuation of old problem
    By blurrymadness in forum Windows Programming
    Replies: 1
    Last Post: 04-20-2007, 07:54 PM
  5. Laptop Problem
    By Boomba in forum Tech Board
    Replies: 1
    Last Post: 03-07-2006, 06:24 PM

1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21