Logo CodeXlog
  • Home
  • About
  • Recent Posts
  • 게시글
  • Tags
  • Dark Theme
    Light Theme Dark Theme System Theme
Logo Inverted Logo
  • 태그
  • Airline
  • Algorithms
  • Ansible
  • Arithmetic
  • Array
  • Autojump
  • AWS
  • Backjoon
  • Bublesort
  • C
  • CentOS
  • Deep-Learning
  • Django
  • Embeded
  • Embeded-System
  • Git
  • Git Bash
  • Github
  • GitLab
  • Hugo
  • Hugo-Toha Theme
  • Hydejack Theme
  • IaC
  • Jekyll
  • Level 17
  • Level 4
  • Loop
  • MacOS
  • Manual
  • Math
  • MinGW
  • Online-Judge
  • OpenCV
  • OS
  • Pattern
  • Prime Number
  • Programming Tips
  • Python
  • RHEL
  • Scanf
  • Sort
  • String
  • Study
  • System-Programming
  • Tensor-Flow
  • Terrafrom
  • Theory
  • Ubuntu
  • Upgrade
  • Vim
  • Window
  • 비교분석
  • 초기설정
Hero Image
강제 캐스팅에 의한 1byte 단위 접근 방법

1Byte access 강제 캐스팅에 의한 1byte 단위 접근 방법 다음과 같이 출력되도록 코드를 짜시오. temp : 0x12345678 temp : 0x78563412 // 강제 캐스팅에 의한 1byte 접근법 #include <stdio.h> int main(){ char *s; char swap_char; int temp=0x12345678; s=(char*)&temp; //4byte의 값을 1byte씩 접근 // a=(char)&temp; 변수 자료형의 형변환 printf("temp : 0x%x\n",temp ); swap_char=*s; *s=*(s+3); *(s+3)=swap_char; swap_char=*(s+1); *(s+1)=*(s+2); *(s+2)=swap_char; printf("temp : 0x%x\n",temp ); } 이런 방법론은 Endian 문제에 적용시킬수 있다. Little Endian 과 Big Endian 과의 데이터 불일치가

  • Study
  • C
  • Theory
  • Embeded
2018년 6월 15일 금요일 | 5
바로가기
  • About
  • Recent Posts
  • Tags
Contact me:
  • codex.devlab@gmail.com
  • ehdwn1991
  • Codex

책임 고지: This theme is under MIT license. So, you can use it for non-commercial, commercial, or private uses. You can modify or distribute the theme without requiring any permission from the theme author. However, the theme author does not provide any warranty or takes any liability for any issue with the theme.