Im trying to create a function to copy my card struct. im starting off easy with just copying the cvalue. however, my cvalue isnt copying, it is still reading 5 when should read 1000.
#include <iostream>
#include <fstream>
#include <ctime>
#include <stdlib.h>
#include <string>
using namespace std;
//Structs
struct card
{
char suit[8];
char rank[6];
int cvalue;
char location;
};
void copyCard(card destination, card source);
int main()
{
card card1;
card card2;
card1.cvalue = 1000;
card2.cvalue = 5;
card *card1p = &card1;
copyCard(card2, card1);
cout << card2.cvalue << endl;
}
void copyCard(card destination, card source)
{
card *myPointer;
myPointer = &source;
(*myPointer).cvalue = source.cvalue;
myPointer = &destination;
destination.cvalue = (*myPointer).cvalue;
}