#include
void swap( char* pA, char* pB, unsigned tam) {
for( unsigned i = 0; i < tam; i++) {
char tmp = *pA;
*pA = *pB;
Well, your function is expecting a pointer to a character for the first two arguments
void swap( char* pA, char* pB, unsigned tam)
but you are passing in pointers to double
double a = 1.0;
double b = 2.0;
swap(&a, &b, sizeof(double)); //This line gives the error
The following would allow you to swap two doubles, unless there is a specific reason you are swapping one byte at a time:
void swap(double *pA, double *pB, unsigned int tam) {
double tmp = *pA;
*pA = *pB;
*pB = tmp;
}