Advertisement
dmilicev

struct.c

Apr 2nd, 2021 (edited)
631
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C 1.24 KB | None | 0 0
  1. /*
  2.  
  3.     struct.c
  4.  
  5.     https://web.facebook.com/photo/?fbid=134245601975321&set=gm.1857167567775418
  6.  
  7.     Correct format specifier for double in printf ( %lf od %f )
  8.     https://stackoverflow.com/questions/19952200/scanf-printf-double-variable-c
  9.     https://stackoverflow.com/questions/4264127/correct-format-specifier-for-double-in-printf/4264154
  10.  
  11.  
  12.     You can find all my C programs at Dragan Milicev's pastebin:
  13.  
  14.     https://pastebin.com/u/dmilicev
  15.  
  16. */
  17.  
  18. #include <stdio.h>
  19.  
  20. struct info
  21. {
  22.     char name[20];
  23.     int age;
  24.     double salary;
  25. };
  26.  
  27. // Function declarations because the function is written below main()
  28. void display( struct info try );
  29.  
  30. int main(void)
  31. {
  32.     printf("\n We work with structure in C-Programming \n\n");
  33.  
  34.     struct info Man = { "Md. Delwar Hossain", 23, 40000 };
  35.  
  36.     display(Man);
  37.  
  38.     return 0;
  39. }
  40.  
  41. // void because there is no need for returning value
  42. void display( struct info try )
  43. {
  44.     printf("\n %s \n", try.name);
  45.     printf("\n %d \n", try.age);
  46.     printf("\n %f \n", try.salary);
  47.  
  48. //  Correct format specifier for double in printf ( %lf or %f )
  49. //  https://stackoverflow.com/questions/19952200/scanf-printf-double-variable-c
  50. //  https://stackoverflow.com/questions/4264127/correct-format-specifier-for-double-in-printf/4264154
  51. }
  52.  
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement