[Code example] Struct function makepoint page 130

User avatar

Topic author
BJT
Site Admin
Site Admin
Posts: 141
Joined: Thu Apr 20, 2017 4:43 pm
Instruction: University Student
Gender:
Age: 27
Venezuela

Struct function makepoint page 130

Post by BJT » Sat May 13, 2017 9:57 pm

  1. #include <stdio.h>
  2. #include <stdlib.h>
  3.  
  4. struct point
  5. {
  6.     int x;
  7.     int y;
  8. };
  9.  
  10. struct point makepoint(int x, int y);
  11.  
  12. int main()
  13. {
  14.     struct point p1=makepoint(15,45);
  15.     printf("%d %d\n",p1.x,p1.y);
  16.     return EXIT_SUCCESS;
  17. }
  18.  
  19. struct point makepoint(int x, int y)
  20. {
  21.     struct point temp;
  22.     temp.x=x;
  23.     temp.y=y;
  24.     return temp;
  25. }

output

Code: Select all

15 45
word count: 70

Link:
BBcode:
HTML:
Hide post links
Show post links

Who is online

Users browsing this forum: No registered users and 2 guests