Hello, i have to write a program using C++ that will store 3 characters into 3 variables, and using pointers i have to rearrange the order in a function. so if c1, c2, c3 have the value 2,4,6....using pointers i have to switch the values of c1, c2, and c3 to 6,4,2. Here is what i have written so far, but it wont compile correctly, can anyone help?
#include <iostream>
int order_chars( char*, char*, char* );
int main()
{
char c1 = 5;
char c2 = 10;
char c3 = 15;
char* c1ptr;
char* c2ptr;
char* c3ptr;
c1ptr = &c3;
c2ptr = &c2;
c3ptr = &c1;
order_chars ( &c1, &c2, &c3 )
return 0;
}
int order_chars( char c3ptr, char c2ptr, char c1ptr )
{
std::cout << c1ptr << c2ptr << c3ptr << std::endl;
return 0;
}