TylerM
TylerM

Reputation: 151

String in array into another array

I'm trying to set an array to a string from another array. This is in C programming.

gates[gatenum]=&seperation[a+1];

where both a and gatenum are both ints. And both arrays are declared as:

char seperation[3000][100];
char *gates[100][10];

So basically what I'm asking is how can I set gates[gatenum] to the string that is in seperation[a+1]

Thank you in advance

Upvotes: 0

Views: 64

Answers (2)

cowboydan
cowboydan

Reputation: 1102

strncpy(gates,seperation,sizeof(gates));

Upvotes: 0

aet
aet

Reputation: 7292

Drop the second dimension of gates.

char *gates[100];

Then you can assign gates[gatenum] = seperation[a+1];

Upvotes: 1

Related Questions