banner
Lifestream
  • 전체 카테고리 (104)
    • Digital Life (40)
      • Picture (20)
      • Video (20)
    • Daily Life (20)
    • Game Life (5)
    • Code Life (18)
    • Information Life (19)
profile
Home Category Guestboook Notice
Manage Write
  • 전체 카테고리 (104)
    • Digital Life (40)
      • Picture (20)
      • Video (20)
    • Daily Life (20)
    • Game Life (5)
    • Code Life (18)
    • Information Life (19)
GTK_LeonHeart
Manage Write
구독하기 RSS 어두운 모드 밝은 모드
Code Life
[C++] float형의 메모리 적재
2018. 4. 12. 21:59 · GTK_LeonHeart ·


1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
#include<stdio.h>
 
int main(void)
{
    int arr[9]={0,};
    int iCount=0, iCount1;
    int mock, namur;
    int i;
    float k=3.2f;
 
    unsigned char * ucP = (unsigned char *)&k;
 
    printf("// 메모리에 역순으로 적재 //\n");
    printf("\n< 16진수로 출력 >\n");
    for(i=1;i<=4;i++)
    {
        printf("[%x] ", *ucP);
        ucP++;
    }
    printf("\n");
 
    ucP = (unsigned char *)&k;
     
    printf("\n<  2진수로 출력 >\n");
    for(i=1;i<=4;i++)
    {
        mock = (int)*ucP;
        iCount=0;
        while(1)
        {
            namur = mock%2;
            mock = mock/2;
            arr[iCount]=namur;
            iCount++;
            if(mock==0)
            {
                arr[iCount]=mock;
                break;
            }
        }
        printf("[");
        for(iCount1=7;iCount1>=0;iCount1--)
        {
            printf("%d", arr[iCount1]);
        }
        printf("] ");
        ucP++;
    }
    printf("\n\n");
    return 0;
}
Colored by Color Scripter
cs


저작자표시 (새창열림)
카테고리 다른 글
related
[C++] 배열의 주소 확인
related
[C++] 함수포인터 사용하기
related
[C++] 함수를 포인터로 호출
related
[C++] 피보나치 수열
more

Links

  • faviconLifstream NAS
  • faviconThe LAST Web page
  • favicon월반장의 바구니
  • favicon박수홍2 의 고전컴 세상
  • favicon패싱님 티스토리
  • favicon혼자 끄적이는 블로그
  • favicon땀똔즈 블로그
  • favicon변덕 심한 묘한오빠
  • faviconSONYLOVE
  • favicon북쉐프 로샤씨

Notice

  • thumbnail20.01.05 블로그 스킨 업데이트
  • thumbnail18.04.18 안녕하세요

Recent Posts

+ 더 보기

Recent Comments

GTK_LeonHeart
Game, Media , Life, Infomation.
Blog by GTK_LeonHeart Designed by Marshall K

티스토리툴바