It depends on what you are doing. Just seeing those two snippets of code, there is no practical difference (except in the first case where you allocate dynamically you must not forget to free the memory).
They're useful like when you want your program to actually produce something instead of just have it do private computation unto itself (which a smart compiler would optimize to a no-op). ;-)
freethe memory).mystruct testwill allocate on the stack