Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #include<stdio.h>
- int summa(int a, int b);
- ///////////////////////////////////////////////
- int main()
- {
- int a, b, c;
- scanf("%d%d%d", &a, &b, &c);
- switch(c)
- {
- case 1: c = summa(a, b);
- printf("%d + %d = %d\n", a, b, a+b, c);
- break;
- case 2: c=a-b;
- printf("%d - %d = %d\n", a, b, c);
- break;
- case 3: c=a*b;
- printf("%d * %d = %d\n", a, b, c);
- break;
- }
- }
- /////////////////////////////////////////////
- int summa(int a, int b)
- {
- return a + b;
- }
- // printf("%d\n",a);
- // printf("%d\n",b);
- /* #include<stdio.h>
- /////////////////////////////////
- struct Big
- {
- int length;
- int width;
- };
- ////////////////////////////////////////////
- int main()
- {
- Big a, b;
- a.length = 12;
- printf(" a.length = %d\n", a.length);
- printf("address a.length = %d\n", &a.length);
- printf("address a. width = %d\n", &a.width);
- }*/
- /*
- #include<stdio.h>
- /////////////////////////////////
- struct Big
- {
- int length;
- int width;
- double max;
- float min;
- };
- void foo(Big *p );
- void f_2(Big *pb);
- ////////////////////////////////////////////////
- int main()
- {
- Big b;
- printf(" adress lenght = %d\n", &b.length);
- printf(" adress width = %d\n", &b. width);
- printf(" adress max = %d\n", &b. max);
- printf(" adress min = %d\n", &b. min);
- foo(&b);
- f_2(&b);
- }
- ////////////////////////////////////////////////
- void f_2(Big *pb)
- {
- printf(" adress lenght = %d\n", &pb->length);
- printf(" adress width = %d\n", &pb-> width);
- printf(" adress max = %d\n", &pb-> max);
- printf(" adress min = %d\n", &pb-> min);
- }
- ////////////////////////////////////////////////
- void foo(Big *pb)
- {
- char *p = (char*)pb;
- printf(" p = %d\n", p); p = p + 4;
- printf(" p + 4 = %d\n", p); p = p + 4;
- printf(" p + 4 = %d\n", p); p += 8;
- printf(" p + 8 = %d\n", p);
- }
- */
- /*
- #include<stdio.h>
- /////////////////////////////////
- struct Big
- {
- int length;
- int width;
- double max;
- float min;
- };
- ////////////////////////////////////////////////
- int main()
- {
- Big b;
- printf(" adress lenght = %d\n", &b.length);
- printf(" adress width = %d\n", &b. width);
- printf(" adress max = %d\n", &b. max);
- printf(" adress min = %d\n", &b. min);
- }
- */
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement