passing variables to subroutines in C
I always forget how to do it!
//declare variable globally
int TINF;
//in the subroutine use a * for a pointer, and then continue throughout
void epi_stats(int *TINF) {
*TINF = something;
}
//in the main program call the subroutine and assign the value using &
int main(int argc, char** argv) {
epi_stats(&TINF);
}
Add a comment
You are not allowed to comment on this entry as it has restricted commenting permissions.