Yahoo Answers is shutting down on May 4th, 2021 (Eastern Time) and beginning April 20th, 2021 (Eastern Time) the Yahoo Answers website will be in read-only mode. There will be no changes to other Yahoo properties or services, or your Yahoo account. You can find more information about the Yahoo Answers shutdown and how to download your data on this help page.

printf statement?

struc coord {

float x;

float y;

} pt1 = {1.1,2.2},pt2, *pt=&pt2;

how do i print out the values of the structure pt1?

2 Answers

Relevance
  • 1 decade ago
    Favorite Answer

    If you just want to print out x and y values of pt1, just use printf like this.

    printf("x=%f and y=%f\n",pt1.x, pt1.y);

  • Anonymous
    1 decade ago

    You'll need to print the individual values, you can't "print" a struct. Write a function that takes structs of type coord, and then prints x and y.

Still have questions? Get your answers by asking now.