Advertisement
mario_mos

tabpoint

Jul 25th, 2023
23
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.95 KB | None | 0 0
  1. #include <stdio.h>
  2. #include <math.h>
  3. #include <stdlib.h>
  4. #include <time.h>
  5. #include <string.h>
  6.  
  7. char invtab(char arr[])
  8. {
  9. arr[0] = arr[4];
  10. arr[1] = arr[3];
  11. arr[2] = arr[2];
  12. arr[3] = arr[1];
  13. arr[4] = arr[0];
  14. }
  15.  
  16. char invpoint(char arr[])
  17. {
  18. int *q = &arr[0];
  19. q = 'n';
  20. int *p = &arr[1];
  21. p = 'a';
  22. int *z = &arr[2];
  23. z = 'm';
  24. int *o = &arr[3];
  25. o = 'a';
  26. int *u = &arr[4];
  27. u = 'm';
  28.  
  29. return printf("Avec pointeurs : %c%c%c%c%c\n",q,p,z,o,u);
  30.  
  31. }
  32.  
  33. int main()
  34. {
  35.  
  36.  
  37. /*int x[5] = {1, 2, 4, 8, 16};
  38. int *p = &x[0];
  39. int *q = x;
  40. int *r =q;
  41.  
  42. printf("%d %d %d %d %d %d\n",x[0],*p,x[1],*(p+1),x[2],*(p+2));*/
  43.  
  44.  
  45. char arr[]="maman";
  46. invtab(arr);
  47. printf("Avec tableau : %s\n",arr);
  48.  
  49. invpoint(arr);
  50.  
  51.  
  52. }
  53.  
  54. */Avec tableau : naman
  55. Avec pointeurs : namam
  56. 10:33:05: /home/mariomoser/C_learning_journey/build-pointeurs_1-Desktop-Debug/pointeurs_1 exited with code 0*/
  57.  
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement