Hardcode a vertex

Hello, people. I have a function that outputs the x, y and z coordinates of a vertex after selecting it from 3D sphere mesh. Each vertex in my project also has an id. Now, I need a certain vertex, for example the vertex with the id=40 to move in a different direction, so I have to give it new x, y and z coordinates. Here is the function:

void mouse(int button, int state, int x, int y) 
	GLint viewport[4]; 
	GLdouble modelview[16], 
	GLfloat wx=x, wy, wz;
    printf("made pick on %f %f %f 
", ox, oy, oz); 
    processhits (nhits, buffer);
	if (vertexSelectat==40)


In my project, Vertex is defined as follows:

typedef struct Vertex {
  float x, y, z;
  int id;
} Vertex;

After I build the project, I get 6 errors "syntax error: missing ‘;’ before ‘.’ after every line where I specify Vertex coordinates. I am new to both OpenGL and C++ so sorry if this is a silly question. Waiting for some help, thank you for your time :). If you request, I can attach the whole project here.

Before asking questions about using OpenGL from C, you should first learn to program in C.

And “learn” doesn’t mean “spend a couple of hours reading a book”; you should be able to write non-trivial programs.

If you have problems with learning C, ask on a forum dedicated to C rather than one dedicated to OpenGL.

it’s not an opengl question.

typedef struct Vertex {   float x, y, z;   int id; } [b]Vertex[/b];

here you try to declare an instance of structure named “Vertex”, under the name “Vertex”. and you try to use it as an object. how compiler should interpret this? it’s like writing “int int;”. it doesn’t complain about this line only because of legacy from C-language, where writing struct name as a postfix actually meant something else.

Wrong. In C, it declares a structure tag named Vertex and a type named Vertex. In C++, it declares the type named Vertex in two different ways. In neither language does a typedef statement declare an instance of anything.

yes, but in his mind, that’s what he tries to do. he thinks he’s declaring an instance of Vertex like that and also that it is legal to call an instance of the type the same name as the type. that’s how it looks. i don’t think he was aware, that writing struct name after it’s body means something different.

Sorry for this question, it was inappropriate to post it here, I noticed my mistake right away. I should have declared a variable of type Vertex, such as: Vertex vertex, then used vertex.x, vertex.y, vertex.z . I also found out a way to solve my problem, by relating how the code reads the .off file with my function. I’m not a programmer and I don’t aspire being one, this is just a project, and I can state that I won’t need OpenGL in my career (or I will need it rarely). I am sorry again.