programming in C language

Collapse
X
 
  • Time
  • Show
Clear All
new posts
  • Jhon101
    New Member
    • Aug 2010
    • 1

    #1

    programming in C language

    i have to make
    4 vectors they are array vectors, and compare them contents
    print one bye one, but in ascendent order , i want to use the burble method to compare they´re contents but i have to make the conditions.


    #include <stdio.h>
    #include <math.h>
    int main()
    {

    int *a[]={1,2,3,43,42,1 2,43,5,65,76},
    *b[]={98,65,43,23,2 1,3,4,54,65,76, 6},
    *c[]{32,3,2,43,4,6, 67,7,45,23,6},
    *d[]={23,45,7,7,87, 8,98,65,6,87,34 };
    int i=0,j=0,point;

    for(i=0;i<10;i+ +)
    {
    for(j=0;j<10;j+ +)
    {
    if(&(*a[j])>&(*a[j+1]))
    {
    atof(point) = &*(a+i);
    &*(a[j])=&*(a[j+1]);
    &*(a[j+1])=point;
    }
    }
    printf("a=%d \n",a[i]);
    }
    system("pause") ;

    }
  • whodgson
    Contributor
    • Jan 2007
    • 542

    #2
    You will have to sort each one to get their elements into ascending order. How do you intend to compare them?
    Remember each of these arrays have eleven elements so your loop condition needs to reflect this!
    Code:
    Also to help others please enclose your code in code tags
    by selecting code and pressing # above.

    Comment

    • weaknessforcats
      Recognized Expert Expert
      • Mar 2007
      • 9214

      #3
      This code won't even compile.

      You have arrays of integer pointers intialized to intigers. Won't work.

      Comment

      Working...