I'm sorting an array of names and my IDE is giving me "no matching function for call to 'strcpy'. Here are the values I set up:
char Names [MaxNames] [MaxCharsPerName + 1];
const int MaxNames (20);
const int MaxCharsPerName (15);
Here is my function
void SortNames (const char Names[][MaxCharsPerName + 1], int NumNames)
{
int i;
int NumElements;
bool Sorted;
char Temp; // size 15?
NumElements = NumNames;
do {
Sorted = true;
NumElements--;
for (i = 0; i < NumNames; i++)
{
if(Names[i-1] > Names[i]){
strcpy(Temp, Names[i]);
strcpy(Names[i], Names[i+1]);
strcpy(Names[i+1], Temp);
}
}
} while (!Sorted);
Do I have to use a reference or something?
Oh and these are at the top:
include
using namespace std;
#include "Constants.h"
#include "Functions.h"
#include <string.h>
#include <stdio.h>