Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- /*
- struct.c
- https://web.facebook.com/photo/?fbid=134245601975321&set=gm.1857167567775418
- Correct format specifier for double in printf ( %lf od %f )
- https://stackoverflow.com/questions/19952200/scanf-printf-double-variable-c
- https://stackoverflow.com/questions/4264127/correct-format-specifier-for-double-in-printf/4264154
- You can find all my C programs at Dragan Milicev's pastebin:
- https://pastebin.com/u/dmilicev
- */
- #include <stdio.h>
- struct info
- {
- char name[20];
- int age;
- double salary;
- };
- // Function declarations because the function is written below main()
- void display( struct info try );
- int main(void)
- {
- printf("\n We work with structure in C-Programming \n\n");
- struct info Man = { "Md. Delwar Hossain", 23, 40000 };
- display(Man);
- return 0;
- }
- // void because there is no need for returning value
- void display( struct info try )
- {
- printf("\n %s \n", try.name);
- printf("\n %d \n", try.age);
- printf("\n %f \n", try.salary);
- // Correct format specifier for double in printf ( %lf or %f )
- // https://stackoverflow.com/questions/19952200/scanf-printf-double-variable-c
- // https://stackoverflow.com/questions/4264127/correct-format-specifier-for-double-in-printf/4264154
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement