Compare commits

..

No commits in common. "6c2b2b8dcd34b6280fe95d2ac844c61b7b0ef29c" and "178291f9f013038020f87acdbc044801b9cf2053" have entirely different histories.

6 changed files with 0 additions and 122 deletions

View file

@ -1,27 +0,0 @@
/* Pointeurs sur 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 *P;
P=T;
// Référence
printf("T = %d ; P = %d\n", T, P); // T = 557221504 ; P = 557221504
printf("&T = %d ; &P = %d\n", &T, &P); // &T = 557221504 ; &P = 557221496
printf("*T = %d ; *P = %d\n", *T, *P); // *T = 12 ; *P = 12
// Questions
printf("%d\n", *P+2); // 14
printf("%d\n", &T[4]-3); // 557221508
printf("%d\n", P+(*P-10)); // 557221512
printf("%d\n", *(P+2)); // 34
printf("%d\n", T+3); // 557221516
printf("%d\n", *(P+*(P+8)-T[7])); // 23
printf("%d\n", &P+1); // 557221504
printf("%d\n", &T[7]-P); // 7
return 0;
}

View file

@ -1,37 +0,0 @@
/* Retirer les éléments d'un tableau */
#include <stdlib.h>
#include <stdio.h>
int main(int argc, char *argv[]) {
int X = 0, n, *P1, *P2;
printf("Saississez la taille de la chaîne : ");
scanf("%d", &n);
int T[n];
for (P1 = T; P1 < T+n; P1++) {
*P1 = 0;
printf("Saississez le caractère à l'indice %d : ", P1-T);
scanf("%s", P1);
}
printf("Saississez la caractère X : ");
scanf("%s", &X);
P2 = T;
for (P1 = T; P1 < T+n; P1++) {
if (*P1 != X) {
*P2 = *P1;
P2++;
}
}
*P2 = '\0';
for (P1 = T; P1 < T+n; P1++) {
if (*P1 == '\0') {
break;
}
printf("%s", P1);
}
printf("\n");
return 0;
}

View file

@ -1,16 +0,0 @@
14
L
a
n
g
a
g
e
C
e
n
P
E
I
P
e

View file

@ -1,24 +0,0 @@
/* 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;
}

View file

@ -1,9 +0,0 @@
all: $(patsubst %.c,%.exe,$(shell ls *.c))
%.exe: %.c
gcc -g $< -o $@ -lm
.PHONY: all clean
clean:
rm *.exe

View file

@ -1,9 +0,0 @@
/* Exercice */
#include <stdlib.h>
#include <stdio.h>
#include <math.h>
int main(int argc, char *argv[]) {
return 0;
}