Skip to content

Instantly share code, notes, and snippets.

@kimhoki
Created June 16, 2015 10:45
Show Gist options
  • Save kimhoki/d755555ac8d06d3054aa to your computer and use it in GitHub Desktop.
Save kimhoki/d755555ac8d06d3054aa to your computer and use it in GitHub Desktop.
[ array] 파일시스템의 버디 기법에 사용된 배열

파일시스템의 버디 기법에 사용된 배열 어래이 관련 내용

#include <stdio.h>
#include <stdlib.h>
#include <string.h>
int main()
{
int a[7] = {1,2,3,4,5,6,7};
int *p;
int index;
p = &a[5];
index = p -a;
printf("index: %d\n", index);
return 0;
}
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
int main()
{
int a[7] = {1,2,3,4,5,6,7};
int *p;
int index;
p = &a[5];
//(120 - 100) / sizeof(a[0]);
index = p -a; // &a[5] - &a[0]
// &*(a+5) - &*(a+0)
// a+5 -a
// 5
printf("index: %d\n", index);
return 0;
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment