Is it considered bad practice to do this?
In other words, is it bad practice to use a pointer twice as I've done above? If so, what's the correct thing to do?Code:#include <stdio.h> #include <stdlib.h> int main(void) { unsigned char* fileContents; //Following function returns a memory location of heap-allocated data fileContents = GetFileContents("foo.txt"); free(fileContents); fileContents = GetFileContents("bar.txt"); free(fileContents); return 0; }
Bookmarks