Ajout des TP
This commit is contained in:
19
BUT1/DEV1.1/Debogueur/1.c
Normal file
19
BUT1/DEV1.1/Debogueur/1.c
Normal 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
20
BUT1/DEV1.1/Debogueur/2.c
Normal 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;
|
||||
}
|
||||
Reference in New Issue
Block a user