diff options
Diffstat (limited to 'sem_5/HLIN504_Systeme')
| -rw-r--r-- | sem_5/HLIN504_Systeme/TP1/TD.txt | 37 | ||||
| -rw-r--r-- | sem_5/HLIN504_Systeme/TP1/argenv | bin | 0 -> 8612 bytes | |||
| -rw-r--r-- | sem_5/HLIN504_Systeme/TP1/argenv.c | 16 | ||||
| -rw-r--r-- | sem_5/HLIN504_Systeme/TP1/fact | bin | 0 -> 8639 bytes | |||
| -rw-r--r-- | sem_5/HLIN504_Systeme/TP1/fact.c | 13 | ||||
| -rw-r--r-- | sem_5/HLIN504_Systeme/TP1/pascal | bin | 0 -> 8779 bytes | |||
| -rw-r--r-- | sem_5/HLIN504_Systeme/TP1/pascal.c | 35 | ||||
| -rw-r--r-- | sem_5/HLIN504_Systeme/TP1/segfault | bin | 0 -> 9810 bytes | |||
| -rw-r--r-- | sem_5/HLIN504_Systeme/TP1/segfault.c | 8 | ||||
| -rw-r--r-- | sem_5/HLIN504_Systeme/TP1/tp1 | bin | 0 -> 8559 bytes | |||
| -rw-r--r-- | sem_5/HLIN504_Systeme/test | bin | 0 -> 8564 bytes | |||
| -rw-r--r-- | sem_5/HLIN504_Systeme/testfile.c | 9 |
12 files changed, 118 insertions, 0 deletions
diff --git a/sem_5/HLIN504_Systeme/TP1/TD.txt b/sem_5/HLIN504_Systeme/TP1/TD.txt new file mode 100644 index 0000000..f6a8d0c --- /dev/null +++ b/sem_5/HLIN504_Systeme/TP1/TD.txt @@ -0,0 +1,37 @@ +Exercice 1 :
+int : 4 octets
+float : 4 octets
+char : 4 octets
+pointeur : 8 octets
+
+2) Une variable non initialisé contient une valeur Random
+
+3) les static dans le secteur static, *td dans le secteur dynamique, (*h) est defini dnas le segment code, et le reste
+dans le tas.
+
+4)
+
+5)
+
+Exercice 2 :
+1) int tab[N1];
+2)scanf("%d", N2);
+int tab[N2];
+3) scanf("%d", N3);
+int * tab = malloc(N3*sizeof(int));
+4) scanf("%d", N2);
+scanf("%d", N3);
+int ** Mat = malloc(sizeof(int*)*N2);
+for (int i =0; i < N2; i ++){
+ Mat[i]=malloc(sizeof(int)*N3);
+}
+
+On accede a l'element Mat i-j en faisait Mat[i][j], les element ne sont pas initialisés, et la durée de vie s'etend entre le malloc et le free
+
+5) Il faut a tout prix preserver la valeur de Mat, qui est l'adresse du tableau contenant les adresses des tableaux de la matrice.
+
+6) int Mat[N2][N3];
+La durée de vie est limité, la taille doit etre connu à l'execution...
+
+Exercice 3:
+En systeme mono-programmable, le programme s'execute "normalement" jusqu'a l'arret du processeur, dans un systeme multi-progammable,
diff --git a/sem_5/HLIN504_Systeme/TP1/argenv b/sem_5/HLIN504_Systeme/TP1/argenv Binary files differnew file mode 100644 index 0000000..63f556e --- /dev/null +++ b/sem_5/HLIN504_Systeme/TP1/argenv diff --git a/sem_5/HLIN504_Systeme/TP1/argenv.c b/sem_5/HLIN504_Systeme/TP1/argenv.c new file mode 100644 index 0000000..eee73e4 --- /dev/null +++ b/sem_5/HLIN504_Systeme/TP1/argenv.c @@ -0,0 +1,16 @@ +#include <stdio.h>
+#include <stdlib.h>
+
+int main ( int argc, char ** argv, char *envp[]){
+ printf("Nb d'arguments : %d \n", argc);
+ for (int i = 0 ; i < argc; i ++){
+ printf(" Argument %d : %s \n", i, argv[i]);
+ }
+ printf ("Environnement : \n");
+ int index = 0;
+ while(envp[index]){
+ printf("Var Env %d : %s \n",index,envp[index]);
+ index++;
+ }
+ return 0;
+}
diff --git a/sem_5/HLIN504_Systeme/TP1/fact b/sem_5/HLIN504_Systeme/TP1/fact Binary files differnew file mode 100644 index 0000000..87ba3f7 --- /dev/null +++ b/sem_5/HLIN504_Systeme/TP1/fact diff --git a/sem_5/HLIN504_Systeme/TP1/fact.c b/sem_5/HLIN504_Systeme/TP1/fact.c new file mode 100644 index 0000000..3c33b09 --- /dev/null +++ b/sem_5/HLIN504_Systeme/TP1/fact.c @@ -0,0 +1,13 @@ +#include <stdio.h>
+#include <stdlib.h>
+
+int fact (int x);
+
+int main (int argc, char ** argv){
+ printf("%d \n", fact(atoi(argv[1])));
+ return 0;
+}
+
+int fact (int x){
+ return x == 0 ? 1: x * fact( x-1);
+}
diff --git a/sem_5/HLIN504_Systeme/TP1/pascal b/sem_5/HLIN504_Systeme/TP1/pascal Binary files differnew file mode 100644 index 0000000..9ae5674 --- /dev/null +++ b/sem_5/HLIN504_Systeme/TP1/pascal diff --git a/sem_5/HLIN504_Systeme/TP1/pascal.c b/sem_5/HLIN504_Systeme/TP1/pascal.c new file mode 100644 index 0000000..9e98eda --- /dev/null +++ b/sem_5/HLIN504_Systeme/TP1/pascal.c @@ -0,0 +1,35 @@ +#include <stdio.h>
+#include <stdlib.h>
+
+int ** pasc(int n);
+void printtab(int ** tab, int n);
+int main ( int argc, char ** argv){
+ // pasc(atoi(argv[1]));
+ printtab(pasc(atoi(argv[1])), (atoi(argv[1])));
+ return 0;
+}
+
+void printtab(int ** tab, int n){
+ for(int i = 0; i < n; i ++){
+ for (int j = 0; j < n; j ++){
+ printf ("%d \t ", tab[i][j]);
+ }
+ printf("\n");
+ }
+}
+int ** pasc(int n){
+ int ** tab = malloc ( sizeof(int*)*n);
+ for (int i =0; i < n; i ++){
+ tab[i]=malloc(sizeof(int)*n);
+ for (int j = 0 ; j < n; j ++){
+ tab[i][j]=0;
+ }
+ }
+ for (int i=0; i < n; i ++){
+ for (int j = 0 ; j <= i; j ++){
+ tab[i][j]= (i>0?(j>0?tab[i-1][j]+tab[i-1][j-1]:tab[i-1][0]):1);
+ // printf("%d %d %d \n",i,j, tab[i][j]);
+ }
+ }
+ return tab;
+}
diff --git a/sem_5/HLIN504_Systeme/TP1/segfault b/sem_5/HLIN504_Systeme/TP1/segfault Binary files differnew file mode 100644 index 0000000..0444f07 --- /dev/null +++ b/sem_5/HLIN504_Systeme/TP1/segfault diff --git a/sem_5/HLIN504_Systeme/TP1/segfault.c b/sem_5/HLIN504_Systeme/TP1/segfault.c new file mode 100644 index 0000000..b864316 --- /dev/null +++ b/sem_5/HLIN504_Systeme/TP1/segfault.c @@ -0,0 +1,8 @@ +#include <stdio.h>
+#include <stdlib.h>
+char *s;
+void g(void){printf("%c\n",s[0]);}
+void f(void){g();}
+int main(){
+ f();
+}
diff --git a/sem_5/HLIN504_Systeme/TP1/tp1 b/sem_5/HLIN504_Systeme/TP1/tp1 Binary files differnew file mode 100644 index 0000000..244e612 --- /dev/null +++ b/sem_5/HLIN504_Systeme/TP1/tp1 diff --git a/sem_5/HLIN504_Systeme/test b/sem_5/HLIN504_Systeme/test Binary files differnew file mode 100644 index 0000000..acc4660 --- /dev/null +++ b/sem_5/HLIN504_Systeme/test diff --git a/sem_5/HLIN504_Systeme/testfile.c b/sem_5/HLIN504_Systeme/testfile.c new file mode 100644 index 0000000..ddb238f --- /dev/null +++ b/sem_5/HLIN504_Systeme/testfile.c @@ -0,0 +1,9 @@ +#include<stdio.h>
+#include<stdlib.h>
+
+int main (int argc, char ** argv){
+printf("taille de argv : %d\n",sizeof(int*));
+
+
+ return 0;
+}
|
