It's pass-by-value vs. pass-by-pointer.
Here's a debugging session with comments
Code:
gdb) b 30
Breakpoint 1 at 0x100000e36: file limits.c, line 30.
(gdb) run
Starting program: limits
Reading symbols for shared libraries +............................. done
Breakpoint 1, main () at limits.c:30
30 LimitesLee(linf,lsup);
(gdb) p linf
$1 = 0
/* Print address of linf variable being passed */
(gdb) p &linf
$2 = (int *) 0x7fff5fbffbb4
/* Print address of lsup variable being passed */
(gdb) p &lsup
$3 = (int *) 0x7fff5fbffbb0
/* Step into LimitesLess function */
(gdb) s
LimitesLee (linf=0, lsup=0) at limits.c:6
6 printf("Introduzca limite inferior y superior.\n");
/* Print addresses of function parameters */
(gdb) p &linf
$4 = (int *) 0x7fff5fbffb9c
(gdb) p &lsup
$5 = (int *) 0x7fff5fbffb98
(gdb)
Notice the addresses are different? Now with pass-by-pointer:
Code:
(gdb) run
Starting program: limits
Reading symbols for shared libraries +............................. done
Breakpoint 1, main () at limits.c:30
30 LimitesLee(&linf,&lsup);
/* Print addresses being passed */
(gdb) p &linf
$1 = (int *) 0x7fff5fbffbb4
(gdb) p &lsup
$2 = (int *) 0x7fff5fbffbb0
(gdb) s
LimitesLee (linf=0x7fff5fbffbb4, lsup=0x7fff5fbffbb0) at limits.c:6
6 printf("Introduzca limite inferior y superior.\n");
/* Print pointers being passed (addresses) */
(gdb) p linf
$5 = (int *) 0x7fff5fbffbb4
(gdb) p lsup
$6 = (int *) 0x7fff5fbffbb0
(gdb)
Notice they're now the same?
Meh...too slow.