I have a structure defined in quaternions.c
typedef struct quaternion{
double arr[4];
} quaternion;
with header file
#ifndef QUATERNIONS_H
#define QUATERNIONS_H
typedef struct quaternion{
double arr[4];
} quaternion;
#endif
Since this is my first time using C structures, I tried testing it out.
#include <stdio.h>
#include "quaternions.h"
int main(){
quaternion a;
a.arr[1]=2.5;
printf("%d\n",a.arr[1]);
return 0;
}
As far as I can tell, what I'm doing is almost identical to this article. However, when I compile and run this, it prints a random gibberish number. What am I doing wrong?