Programmation Avancée en C


ptr_arith2.c

00001 #include <stdio.h>
00002 
00003 int main() 
00004 {
00005     double i = 14.0;
00006     double *p1, *p2;
00007     p1 = &i;
00008     p2 = p1 + 1;
00009 
00010     printf("Adresse p1 = %p \t Adresse p2 = %p\n", p1, p2);
00011     printf("Différence des adresses: %lu \t sizeof(double)=%lu\n",
00012             (unsigned long)p2-(unsigned long)p1,
00013             sizeof(double));
00014     printf("MAIS p2-p1 = %i !\n",p2-p1);
00015     return 0;
00016 }
00017 
00018