Question: I am trying to convert this c++ programming into C. Please help me with this. I am also confuse on namespace in c and how

I am trying to convert this c++ programming into C. Please help me with this. I am also confuse on namespace in c and how does that applies to main function.

#include

namespace rand_mgr {

const unsigned int a = 48271;

const unsigned int m = 0x7fffffff;

typedef struct {

unsigned int seed;

} generator;

generator* create() { generator* g = new generator;

g->seed = time(0); return g;

} void set_seed(generator* g, unsigned int s) {

g->seed = s;

}

unsigned int rand_int(generator* g) {

return g->seed = (a * g->seed) % m; }

}

Thank you

Step by Step Solution

There are 3 Steps involved in it

1 Expert Approved Answer
Step: 1 Unlock blur-text-image
Question Has Been Solved by an Expert!

Get step-by-step solutions from verified subject matter experts

Step: 2 Unlock
Step: 3 Unlock

Students Have Also Explored These Related Databases Questions!