my code is here :
#include <iostream>
using namespace std;
struct Mhs
{
int nim;
char nama[10];
Mhs *next;
};
void fs(Mhs *m)
{
m = m->next;
}
int main()
{
int i;
Mhs mhs[2] = { {1, "Alice", &mhs[1]}, {2, "Bob", &mhs[0]} };
Mhs *m = &mhs[0];
fs(m);
for(i = 0; i < 2; i++)
{
cout << m->nama << ":" << m->nim << " ";
m = m->next;
}
cout << endl;
return 0;
}
why the output is : Alice:1 Bob:2 but already perform the function fs ()
but, if I remove fs(m); and replace m = m->next; then the output will be like this : Bob:2 Alice:1
What different ???????