First, know how memcpy work: the third parameter is the number of bytes copied, however, i still have a problem ...
Here's my struct:
#define ARRONDI(X, Y) 1 + (X / (Y + 1))
#define Taille ARRONDI(Max_Length, 64)
#define Max_D 7
typedef unsigned long long ull;
typedef struct{
ull List[Taille];
ull best_solution[Taille];
ull Dist[Taille];
int borne;
int Length[Max_D-1];
int nb_mark;
}tache_t;
Taille and Max_D are both Macro defined earlier. When i've 2 tache_t, a and b, and i wanna copy the "best_solution" array from one to another, so i type
#include <string.h>
int main(){
int i;
tache_t t;
t.best_solution[0] = 52461701;
t.best_solution[1] = 0;
ull T[Taille];
memcpy(T, t.best_solution, sizeof(ull) * Taille);
for(i=0; i<Taille; i++)
printf("%Lu vs %Lu\n", T[i], t.best_solution[i]);
return 0;
}
But when i checked values, both array were a bit different ... How is it possible ??
I was wondering if it was a padding problem ... but obviously it isnt, right ?