Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • Home
  • SEARCH
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 6852417
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 27, 20262026-05-27T01:22:05+00:00 2026-05-27T01:22:05+00:00

I am new to C programming and am trying to quick sort an array

  • 0

I am new to C programming and am trying to quick sort an array of records. I’m not sure if I am sending the Record to the function properly but my error is

error: conversion from “TaxRecord*” to non-scalar type “TaxRecord” requested
error: no match for “operator<” in “*(table + ((unsigned int)(((unsigned int)left) * 104u))) < pivot”

void qsort(TaxRecord table,int start,int finish);

qsort(theEmployees[i],0,i);

void qsort(TaxRecord table[],int start,int finish) {
    int left = start,
    right = finish;
    TaxRecord pivot = table[((start+finish)/2)];
    TaxRecord temp = table;

    while (left < right) {
        // find left candidate
        while (table[left]  < pivot)
            left++; 
        // find right candidate 
        while (table[right] > pivot)
            right--; 
        if (left <= right) {
            int temp = table[left];
            table[left] = table[right];
            table[right] = temp;
            left++;
            right--;
        } 
    } // while left < right

    if (start < right)
        qsort(table,start,right);
    if (left < finish)
        qsort(table,left,finish);
}
  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-05-27T01:22:05+00:00Added an answer on May 27, 2026 at 1:22 am

    1) Your function prototype doesn’t match the function declaration.

    void qsort(TaxRecord table,int start,int finish);
    void qsort(TaxRecord table[],int start,int finish)
    

    2) You call the function with what appears to be a single array element instead of the array itself.

    qsort(theEmployees[i],0,i);
    

    3) You attempt to assign an array to a single TaxRecord variable.

    TaxRecord temp = table;
    

    4) You attempt to use an int temporary while swapping TaxRecord elements.

    int temp = table[left];
    table[left] = table[right];
    table[right] = temp;
    

    5) The error message sounds like there isn’t a defined operator< for your TaxRecord type.

    My suggestion: instead of fixing your code just use the library qsort or std::sort, depending on whether this is C or C++.

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I am new to programming. I have been trying to write a function in
I'm new to programming in VBA, but what I'm trying to do right now
I'm new to programming and I'm trying to create an array of class objects,
I am new to programming especially jQuery. I am trying to sort (order) images
I am new to programming and trying to write a javascript function to set
i been thinking of a new programming language. Before trying to implement it i
i am new in programming under linux and trying to get working this code:
I'm very new to programming and I am trying to write a program that
I'm fairly new to iPhone programming and am trying to implement a double-component PickerView.
I'm new to windows programming and I'm trying to get notified of all changes

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.