Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #include <iostream>
- using namespace std;
- void foo(int *p);
- /////////////////////////////////////////
- int main()
- {
- for(int i = 1; i < 10; i++)
- {
- foo(&i);
- }
- }
- /////////////////////////////////////////
- void foo(int *p)
- {
- for(int i = 2; i < 10; i++)
- {
- cout << *p;
- cout << " * ";
- cout << i;
- cout << " = ";
- cout.width(2);
- cout << i * (*p) << endl ;
- } cout << " - - - - - - \n";
- }
- /*
- #include <stdio.h>
- void foo(int *p);
- /////////////////////////////////////////
- int main()
- {
- for(int i = 1; i < 10; i++)
- {
- foo(&i);
- }
- }
- /////////////////////////////////////////
- void foo(int *p)
- {
- for(int i = 2; i < 10; i++)
- {
- printf("%d * %d = %2d\n", *p, i, i * *p);
- } printf(" - - - - - -\n");
- }
- */
- /*
- #include <stdio.h>
- void foo();
- /////////////////////////////////////////
- int main()
- {
- for(int i = 1; i < 10; i++)
- {
- foo();
- }
- }
- /////////////////////////////////////////
- void foo()
- {
- static int n = 1;
- printf("n = %d\n", n);
- n ++;
- }
- */
- /*
- #include <stdio.h>
- char* foo(char* p);
- /////////////////////////////////////////
- int main()
- {
- char n[8] = "SONY";
- char *p = foo(&n[2]);
- printf("%c\n", *p);
- }
- /////////////////////////////////////////
- char* foo(char *p)
- {
- static char c = p[-1];
- return &c;
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement