When you post code, enclose it in {code} and {/code} tags (except use [] instead of {}). That will preserve your indentations making it easier for us to understand.

Enclose the entire the program, not just the routine where you think the problem is occurring.

Tell us what happens when you try to run your code. Does it compile? Does a graphics window open? What do you see in the window?

The information u r giving to us is incomplete. What do the functions x() and y() return? Why are u using an uninitialized array (n)? The above code is fine (sematically) apart from the redundant { after glBegin but whether it works or not depends on what u r doing in the x,y functions.

That sort of shape is called a lemniscate. If you follow that link you will find equations for several varieties. I like this one. You want the parametric equations, where you supply a sliding “t” parameter.

More commonly, you would pre-compute all the values and store them in a table, instead of doing lots of sines/cosines at run time. If none of the mathematical shapes look like what you want, then make your own table by drawing your shape on a piece of graph paper, and counting squares to find the x and y coordinates that you need.