Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- // Язык Си ! ! ! ! ! !
- #include <stdio.h>
- int max(int n1,int n2);
- double fmax(double f1,double f2);
- int (*A)(int, int) = max;
- double (*B)(double f1,double f2) = fmax;
- //////////////////////////////////////////////////// (char(*)( ) )
- int main() // (int(*)(int))
- {
- printf("%d \n", A(73 , 21 ));
- printf("%.2f\n", B(1.77, 3.55 ));
- }
- //////////////////////////////////////////////
- int max(int n1,int n2) //
- {
- if(n1 > n2) return n1;
- return n2;
- }
- //////////////////////////////////////////////
- double fmax(double f1,double f2) //
- {
- if(f1 > f2) return f1;
- return f2;
- }
- /*
- 0) extern "C" __declspec(dllexport)
- - - - - - - - - - - - - - - - - -
- 1) int (*_rr)();
- 2) HMODULE hDll = 0;
- 3) hDll = LoadLibrary("dll/for.dll");
- 4) _rr = (int(*)())GetProcAddress(hDll, "_rr");
- 5) FreeLibrary(hDll);
- */
- /*
- #include <stdio.h>
- #include <windows.h>
- HMODULE hDll = 0;
- int (*_foo )(int);
- char (*_SONY)( );
- //////////////////////////////////////////////////// (char(*)( ) )
- int main() // (int(*)(int))
- {
- hDll = LoadLibrary("my/dll_02.dll");
- printf("hDll = %d\n", hDll);
- _SONY = GetProcAddress(hDll, "_SONY");
- _foo = GetProcAddress(hDll, "_foo" );
- for (int i = 0;i < 13; i++)
- {
- printf ("%c" , _SONY());
- }
- printf("foo return %d\n", _foo(1000) );
- }
- */
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement