Advertisement
stream13

breaking the law

Aug 21st, 2013
222
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C++ 0.42 KB | None | 0 0
  1. #include <stdio.h>
  2. #include <stdlib.h>
  3.  
  4. #define size1 16
  5. int main(){
  6.     unsigned char c[size1] = {0};
  7.     unsigned int a = 858927408, b = 97; // 97 == 'a'; 858927408 == "0123"
  8.     *((unsigned int*)c) = a;
  9.     *((unsigned int*)c+1) = b;
  10.     printf("c = '%s'\n", c);
  11.     for(int i = 0; i < size1; ++i){
  12.         printf("%3x ", c[i]);
  13.     }
  14.     printf("\n");
  15.     for(int i = 0; i < size1; ++i){
  16.         printf("%3d ", c[i]);
  17.     }
  18.     printf("\n");
  19.     return 0;
  20. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement