Well i have the following program

where i need to swap students(dynamically created structure array) .

Just cant seem to get the swap right.

Main problem's here :

struct student *stemp;
stemp=(struct student *)malloc(sizeof(student));
*stemp.name=s[i].name;
s[i].name=s[j].name;
s[j].name=stemp->name;

Other info :

where s[i] belongs to a dynamically created array student

struct student{
  char name[20];
  int m1,m2,m3;
};
s[i] is dynamically allocated memory:
struct student* s;
....
s=(struct student *)malloc(n*sizeof(student));

what i've also tried

*stemp=s[i];
s[i]=s[j];
s[j]=*stemp;

Alright I've got it,the right was is:

struct student stemp;
	stemp=*(s+i);
	*(s+i)=*(s+j);
        *(s+j)=stemp;