Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- /////////////////ZAD 1
- #include <stdio.h>
- struct trojkat {
- float a,b,c;
- };
- float zad7_2_1(struct trojkat tr) {
- return tr.a + tr.b + tr.c;
- }
- int main()
- {
- struct trojkat tr;
- tr.a = 3;
- tr.b = 4;
- tr.c = 5;
- printf("\n%f\n",zad7_2_1(tr));
- return 0;
- }
- ///////////ZAD 2
- #include <stdio.h>
- #include <stdlib.h>
- struct trojkat {
- float a,b,c;
- };
- void zad7_2_2(struct trojkat troj1, struct trojkat *troj2) {
- *troj2 = troj1;
- }
- int main()
- {
- struct trojkat tr;
- tr.a = 3;
- tr.b = 4;
- tr.c = 5;
- struct trojkat *tr2 = malloc(sizeof(struct trojkat));
- zad7_2_2(tr,tr2);
- printf("\n\n\n%.0f,%.0f,%.0f\n\n",tr2->a,tr2->b,tr2->c);
- return 0;
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement