Fill Specific Element in Array of Structs

Can I fill a specific element in an array of structs?

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
#include <stdio.h> 
#define SIZE 100

typedef struct 
{
	int x;
	int y;
	int z;
}something;

int main() 
{
	something arr[SIZE];

	arr[0] = {10, 20, 30}; // Is there a way to do this?
	
	return 0;
}
1
2
3
4
5
6
7
8
9
10
11
12
typedef struct 
{
 void set_values(int x_, int y_, int z_) {
  x = x_;
 // etc
 }
	int x;
	int y;
	int z;
}something;

arr[0].set_values(10, 20, 30);

Does this give you any error?
I think its right

Aceix.
Ya it gives me this:
error C2059: syntax error : '{'

Thanks Zaita, that will work!
Topic archived. No new replies allowed.