#include <aephem.h>
#include <stdio.h>
#include <stdlib.h>
#include <time.h>

#define LATITUDE     -12.345     // Degrees north of the equator.
#define LONGITUDE    -67.890     // Degrees east of the meridean.
#define ALTITUDE     5200     // Metres above sea level.
 
int main(int argc, char *argv[]) {
  double jd_ut, jd_ut1, jd_tt, last, ra, dec, dist, alt, az;
 
  jd_ut = ae_ctime_to_jd(time(NULL));  // Current Julian date in UT measure.
  jd_ut1 = jd_ut + ae_dut1(jd_ut) * AE_D_PER_S;     // UT1 measure.
  jd_tt = jd_ut1 + ae_delta_t(jd_ut1) * AE_D_PER_S; // TT measure.
  last = aes_last(jd_ut1, LONGITUDE);   // Local apparent sidereal time.
 
  // Get the geocentric ra/dec of Mars.
  ae_geocentric_from_orbit(jd_tt, &ae_orb_earth, &ae_orb_mars, &ra, &dec,
                           &dist);
 
  // Get the apparent ra/dec of Mars (no atmospheric model).
  aes_topocentric(jd_ut1, LATITUDE, LONGITUDE, dist, &ra, &dec);
 
  // Convert to alt/az.
  ae_radec_to_altaz(last, LATITUDE, ra, dec, &alt, &az);
 
  printf("JD (UT1) = %.5f, JD (TT) = %.5f\n", jd_ut1, jd_tt);
  printf("Apparent ra/dec of Mars = " ae_hms_fmt ", " ae_dms_fmt "\n",
         ae_hms_arg(ra), ae_dms_arg(dec));
  printf("Az/alt of Mars = " ae_dms_fmt ", " ae_dms_fmt "\n", 
         ae_dms_arg(az), ae_dms_arg(alt));
 
  return 0;
}

bash$ gcc -o quick_example quick_example.c -laephem -lm
bash$ date
Thu Mar 29 20:30:21 EDT 2012
bash$ ./quick_example
JD (UT1) = 2456016.52108, JD (TT) = 2456016.52186
Apparent ra/dec of Mars = 10h 32m 59.17s, 12d 47' 2.28"
Az/alt of Mars = 51d 34' 47.19", 50d 29' 21.70"