about pointer
Post on 22-Jul-2015
274 views
Embed Size (px)
TRANSCRIPT
1.
2.
3.
1.
(Memory Mapped IO)
OS
e-Words
C
C C
C
2.
!
int x, *p; x = 1; p = &x; *p = 2; printf("x = %d\n", x);
void swap(int *x, int *y) { int tmp = *x; *x = *y; *y = tmp; }
void swap(int x, int y) { int tmp = x; x = y; y = tmp;}
!
3.
1. or
2. or
3. or
4.
1. or
// Cint puts(const char *s);size_t strlen(const char *s);int strcmp(const char *s1, const char *s2);!// Win32APIATOM RegisterClassEX(const WNDCLASSEX *lpwcx);
2. or
// Cchar *gets(char *s);void memset(void *s, int c, size_t n);void strcpy(char *s1, const char *s2);!// Win32APIBOOL GetWindowRect(HWND hWnd, RECT *lpRect);BOOL GetCursorPos(POINT *lpPOINT);
3. or
// Cvoid qsort(void *data, size_t num_memb, size_t elem_size, int (*cmp)(const void *, const void *));
4.
// Cint scanf(...);
int max_element(const int *data, int n);!int xs[] = { 1, 1, 4, 5, 1, 4 };
xcount!int x = 4;int xs[] = { 1, 1, 4, 5, 1, 4 };int k;!k = count(xs, /* = */ 6, x);!
void iota(int *data, int n);!int xs[5]; { 0, 1, 2, 3, 4 };
xfill!int x = 72;int xs[10];!fill(xs, /* = */ 10, x);!
to_upper_string!char s[] = "u-hyogo";to_upper_string(s);puts(s); // U-HYOGO!int isalpha(int c)int toupper(int c)!isalphatoupperctype.h
int unique(int *data, int n); { 1, 1, 2, 1, 3, 3, 3 } { 1, 2, 1, 3 } !int xs[10] = { 1, 1, 1, 2, 3, 3, 3, 3, 4, 4 };
(x,y)(r,theta)to_polar!atan(y/x)atan2(y,x)
int max_argument(const int *data, int n, int *max_value);!max_valueintNULLOK!int xs[6] = { 1, 1, 4, 5, 1, 4 };
OpenCVcvCvtColor!void cvCvtColor(const IplImage *src, IplImage *dst, int code);!IplImage *color = cvLoadImage("azunyan.jpg", CV_LOAD_IMAGE_COLOR);IplImage *gray = cvCreateImage(cvGetSize(color), IPL_DEPTH_8U, 1);// // codeCV_BGR2GRAY!