Skip to content

Instantly share code, notes, and snippets.

@jgrar
Forked from treeherder/a_g.c
Last active August 29, 2015 13:56
Show Gist options
  • Save jgrar/9258267 to your computer and use it in GitHub Desktop.
Save jgrar/9258267 to your computer and use it in GitHub Desktop.
#include <stdio.h>
struct ret
{
char *id;
int accel_x;
int accel_y;
int accel_z;
int gyro_x;
int gyro_y;
int gyro_z;
};
struct ret ret_init (char *id, int accel_x, int accel_y, int accel_z, int gyro_x, int gyro_y, int gyro_z) {
struct ret r;
r.id = id;
r.accel_x = accel_x;
r.accel_y = accel_y;
r.accel_z = accel_z;
r.gyro_x = gyro_x;
r.gyro_y = gyro_y;
r.gyro_z = gyro_z;
return r;
}
int main()
{
struct ret ret;
ret = ret_init("foo", 1, 2, 3, 1, 3, 2);
printf("%s %d %d %d %d %d %d\n", ret.id, ret.accel_x, ret.accel_y, ret.accel_z, ret.gyro_x, ret.gyro_y, ret.gyro_z);
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment