Hi folks,
int a=10,b=5,tmp;
tmp=a;
a=b;
b=tmp;
This is ordinary swap. I want to do this swap to the structure variables. And how to free the memory of tmp structure variable after swapping.
Hi folks,
int a=10,b=5,tmp;
tmp=a;
a=b;
b=tmp;
This is ordinary swap. I want to do this swap to the structure variables. And how to free the memory of tmp structure variable after swapping.
Jump to PostHi folks,
This is ordinary swap. I want to do this swap to the structure variables. And how to free the memory of tmp structure variable after swapping.I neither see a structure nor a pointer of any type. Care to elaborate?
Hi folks,
This is ordinary swap. I want to do this swap to the structure variables. And how to free the memory of tmp structure variable after swapping.
I neither see a structure nor a pointer of any type. Care to elaborate?
It will depend on the contents of the structure and how it was allocated. Post the structure and appropriate code to get better comments.
Hi folks,
int a=10,b=5,tmp; tmp=a; a=b; b=tmp;
This is ordinary swap. I want to do this swap to the structure variables.
Make tmp an instance of the structure. Move each element as you swap.
And how to free the memory of tmp structure variable after swapping.
Why? It's not necessary.
We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, learning, and sharing knowledge.
You're trying to visit a URL that doesn't currently exist on the web. Most likely, a member posted a link a long time ago to a web page that has since been removed. It's also possible that there was a typo when posting the URL. We redirect you to this notice instead of stripping out the link to preserve the integrity of the post.