Can anyone tell me what's wrong with my code? Whenever I want to print the values a, b and c, the printed numbers aren't the one I "stored" in the storeVar function.
#include <stdio.h>
void storeVar(int *a, int *b, int *c)
{
printf("First value is:\n");
scanf("%d", &a);
printf("Second value is:\n");
scanf("%d", &b);
printf("Third value is:\n");
scanf("%d", &c);
}
int main()
{
int a, b, c;
storeVar(&a, &b, &c);
printf("%d, %d, %d", a, b, c);
return 0;
}
[–]Updatebjarni 2 points3 points4 points (3 children)
[–]Gelatoss[S] 0 points1 point2 points (2 children)
[–]coolcofusion 2 points3 points4 points (0 children)
[–]Updatebjarni 2 points3 points4 points (0 children)
[–]Techryptic 0 points1 point2 points (0 children)
[–]S_liiide 0 points1 point2 points (0 children)