void openUpNow(FILE *x, FILE *y)
{
x = fopen("xwhatever", "r");
y = fopen("ywhatever", "r");
}
int _tmain(int argc, _TCHAR* argv[ ])
{
FILE *x, *y;
openUpNow(x, y);
}
warning C4700: uninitialized local variable ‘x’ used
warning C4700: uninitialized local variable ‘y’ used
Remedy?
I don’t think that’s what you want to do anyway.
Assuming you want
openUpNow()to open the files intoxandyyou should use:In other words, you need to pass the address of the pointers
xandyinto the function.As your code is right now, the call to
openUpNow()doesn’t do anything (and leaks the file-handles) since pointers are passed by value.