This commit is contained in:
Geoffrey Frogeye 2016-03-23 10:29:25 +01:00
parent b2da77824f
commit 6c2b2b8dcd
3 changed files with 24 additions and 2 deletions

View file

@ -2,7 +2,6 @@
#include <stdlib.h>
#include <stdio.h>
#include <math.h>
int main(int argc, char *argv[]) {
int T[] = {12, 23, 34, 45, 56, 67, 78, 89, 90};

View file

@ -2,7 +2,6 @@
#include <stdlib.h>
#include <stdio.h>
#include <math.h>
int main(int argc, char *argv[]) {
int X = 0, n, *P1, *P2;

24
TP4/E3.c Normal file
View file

@ -0,0 +1,24 @@
/* Inversion de tableau */
#include <stdlib.h>
#include <stdio.h>
int main(int argc, char *argv[]) {
int T[] = {12, 23, 34, 45, 56, 67, 78, 89, 90};
int *P1, *P2, temp, n = sizeof(T)/sizeof(int);
P2 = T + n - 1;
for (P1 = T; P1 < T + n/2; P1++, P2--) {
temp = *P1;
*P1 = *P2;
*P2 = temp;
}
for (P1 = T; P1 < T + n; P1++) {
printf("%d, ", *P1);
}
printf("\n");
return 0;
}