13 Nisan 2010 Salı

C++ ile union,unsigned ve bytes Dizisi

//www.ethemsulan.com
#include <cstdlib>
#include <iostream>
using namespace std;
int main(int argc, char *argv[])
{
    union{
          unsigned char bytes[8];
          double value;
          };
    int i;
    value=856987.324;
    for(i=0;i<8;i++){
                     cout<<(int) bytes[i]<<" ";
                     }
    cout<<endl;
    system("PAUSE");
    return EXIT_SUCCESS;
}

Hiç yorum yok:

Yorum Gönder