void set(int h, int m);
int h,m,;
int main(void)
{
set(h,m);
printf("%d%d", h,m);
}
void set(int h, int m)
{
printf ("Enter the first hour (24 hours): ");
scanf("%d%d", &h, &m);
}
I'd like to initialize the global variables h
and m
as a set
function, but it's only within the function and comes out as the initialization value, so what should I do? Instead of declaring void set(void)
, I would like to declare it as void set(int, intm)
.
Just
void set()
{
printf ("Enter the first hour (24 hours): ");
scanf("%d %d",&h,&m);
}
This is how Hashim...
If you receive h and m as parameters like the questioner, the local variables h and m take precedence over the global variables h and m, so you cannot modify the variable you want.
© 2024 OneMinuteCode. All rights reserved.