Skip to content

Instantly share code, notes, and snippets.

@ehermes
Created January 8, 2016 19:51
Show Gist options
  • Select an option

  • Save ehermes/9023d513e763044932f0 to your computer and use it in GitHub Desktop.

Select an option

Save ehermes/9023d513e763044932f0 to your computer and use it in GitHub Desktop.
#include <stdio.h>
#include <stdint.h>
#include <unistd.h>
struct atom {
double pos[3];
uint8_t symbol[2];
};
void main()
{
struct atom my_atom = {.pos = {0,1,2}, .symbol=" H"};
printf("My atom's symbol: %s \n", my_atom.symbol);
printf("My atom's X position is: %f \n", my_atom.pos[0]);
printf("My atom's Y position is: %f \n", my_atom.pos[1]);
printf("My atom's Z position is: %f \n", my_atom.pos[2]);
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment