Read about the how to pass parameters to a function, like pass the value, pass the address (by pointer). Here you need use the second one.
#include <stdlib.h>
#include <stdio.h>
void LimitesLee(int * linf, int * lsup)
{
printf("Introduzca limite inferior y superior.\n");
scanf("%d",linf);
scanf("%d",lsup);
}
void LimitesImprime(int linf, int lsup)
{
printf("Limites: [%d, %d]",linf,lsup);
}
int main()
{
int linf = 0;
int lsup = 0;
LimitesLee(&linf,&lsup);
LimitesImprime(linf,lsup);
system("pause");
return 0;
}
#include <stdlib.h>
#include <stdio.h>
void LimitesLee(int * linf, int * lsup)
{
printf("Introduzca limite inferior y superior.\n");
scanf("%d",linf);
scanf("%d",lsup);
}
void LimitesImprime(int linf, int lsup)
{
printf("Limites: [%d, %d]",linf,lsup);
}
int main()
{
int linf = 0;
int lsup = 0;
LimitesLee(&linf,&lsup);
LimitesImprime(linf,lsup);
system("pause");
return 0;
}
To copy to clipboard, switch view to plain text mode
Bookmarks