icatalin

23.11

Nov 23rd, 2017
61
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C 0.48 KB | None | 0 0
  1. #include <stdio.h>
  2. #include <stdlib.h>
  3.  
  4. //Interschimbare octeti.
  5.  
  6. int main()
  7. {
  8.     int x = 20;
  9.     char *p = &x;
  10.     char *p2 = p + 1;
  11.  
  12.     int aux = *p;
  13.     *p = *p2;
  14.     *p2 = aux;
  15.  
  16.     printf("%d",x);
  17.  
  18.     return 0;
  19. }
  20.  
  21. //sau
  22.  
  23. #include <stdio.h>
  24. #include <stdlib.h>
  25.  
  26. //Interschimbare octeti.
  27.  
  28. int main()
  29. {
  30.     int x = 20;
  31.     char *p = &x;
  32.     char *p2 = p + 1;
  33.  
  34.     char aux = *p;
  35.     *p = *p2;
  36.     *p2 = aux;
  37.  
  38.     printf("%d",x);
  39.  
  40.     return 0;
  41. }
Add Comment
Please, Sign In to add comment