DEV/DEV1.1/partie_1/adress.c

53 lines
838 B
C
Raw Permalink Normal View History

2024-10-14 13:54:43 +02:00
#include <stdio.h>
#include <stdlib.h>
#include <time.h>
/*#1)
int main(void){
float a;
double b;
long double c;
char d;
short int e;
int f;
unsigned long int g;
printf("%p\n", a);
printf("%p\n", b);
printf("%p\n", c);
printf("%p\n", d);
printf("%p\n", e);
printf("%p\n", f);
printf("%p\n", g);
}*/
/*#2)
int main(void){
char min, maj;
char *p = NULL;
for(min = 'a', maj = 'A'; maj <= 'Z'; min++, maj++) {
p = (p == &min) ? &maj : &min;
putchar(*p);
}
putchar('\n');
return EXIT_SUCCESS;
}*/
int main(void){
if(time(NULL)%2){
int x = 59;
p = &x;
} else {
int y = 31;
p = &y;
}
/* fragment inactif
printf("x=%d\n", x);
printf("y=%d\n", y);
*/
printf("%d\n", *p);
return EXIT_SUCCESS;
}