location2.c:
#include <stdlib.h>
struct location
{
float latitude;
float longitude;
};
struct location *new_location()
{
struct location *temp = malloc(sizeof(struct location));
temp->latitude = 0;
temp->longitude = 0;
return temp;
}
main(int argc, char **argv)
{
if (argc < 3)
{
printf("Usage: %s longitude latitude\n", argv[0]);
exit(1);
}
struct location *a_location = new_location();
a_location->latitude = atoff(argv[1]);
a_location->longitude = atoff(argv[2]);
printf("Location: %.2f,%.2f\n", a_location->latitude, a_location->longitude);
free(a_location);
}
struct location
{
float latitude;
float longitude;
};
struct location *new_location()
{
struct location *temp = malloc(sizeof(struct location));
temp->latitude = 0;
temp->longitude = 0;
return temp;
}
main(int argc, char **argv)
{
if (argc < 3)
{
printf("Usage: %s longitude latitude\n", argv[0]);
exit(1);
}
struct location *a_location = new_location();
a_location->latitude = atoff(argv[1]);
a_location->longitude = atoff(argv[2]);
printf("Location: %.2f,%.2f\n", a_location->latitude, a_location->longitude);
free(a_location);
}