Ajout des TP

This commit is contained in:
stiti
2024-02-01 13:55:03 +01:00
parent 4fe273c309
commit 113583b37a
228 changed files with 7094 additions and 0 deletions

19
BUT1/DEV1.1/Debogueur/1.c Normal file
View File

@@ -0,0 +1,19 @@
#include <stdlib.h>
#include <stdio.h>
int somme(int n, int m) {
return n+m;
}
int main(void) {
int valeur;
int* p = &valeur;
printf("Entrez un entier : ");
scanf("%d",p);
printf("Le double vaut %d\n", somme(*p, *p));
return EXIT_SUCCESS;
}
/*L'erreur était le NULL après "int* p"*/

20
BUT1/DEV1.1/Debogueur/2.c Normal file
View File

@@ -0,0 +1,20 @@
#include <stdlib.h>
#include <stdio.h>
#include <string.h>
void envers(const char texte[]) {
unsigned position;
for(position = strlen(texte)-1; position >= 0; position--) {
printf("%c", texte[position]);
}
printf("\n");
}
int main(int argc, char** argv) {
if (argc < 2) {
printf("usage : %s <texte>\n", argv[0]);
return EXIT_FAILURE;
}
envers(argv[1]);
return EXIT_SUCCESS;
}