I wanted to know the difference between using malloc() to allocate data to a pointer and creating an array.
I'm writing a program that gets data from the internet and stores a part of it. It reads a packet with the length of the data that is coming next, then it malloc()'s space for it and gets it. It happens that, somewhere I may need to do something like storageArea = &packet[x]. This means I can't free(packet) anymore. Would it be better if instead of using malloc() and not freeing the pointer, I created a buffer and maybe afford losing some memory?