Here's some code I wrote a long, long time ago. I've drawn the areas immediately surrounding the poles with a triangle-fan and the remainder of the sphere with quad-strips. You could of course, use triangles instead of the quads, but since the pairs of triangles would still be planar, it wont look any different, unless I'm mistaken - it's been a long times since I touched anything GL.
As molbdnilo points out, you'll get a better sphere by calculating your points in a different manner. If the intention is to texture-map the sphere, you'll get better results again if you subdivide and smooth a cube, since this avoids 'pinching' around the poles.
Here's a good article that discusses this: http://www.iquilezles.org/www/articles/patchedsphere/patchedsphere.htm
I should also point-out that there's a problem with the way that I either calculate the normals, or transform then when rotating - I used to get funky lighting results when looking at the sphere when it was rotated. (I think it's with the normals)
Also, looking at the just code now, I'm not sure that I've computed the number of vertices required correctly - you'll have to double-check that.It appears as though I don't store verts for either of the poles in the array.
EDIT:
Here's a pic of the output:

typedef struct {
GLfloat x, y, z;
}vec3;
void myGlutBall(float radius, int numStacks, int numSides)
{
// vec3 points[sides * (sides-1)];
GLfloat curRadius, curTheta, curRho, deltaTheta, deltaRho, curX,curY,curZ;
int curStack, curSlice, numVerts = (numStacks-1)*numSides;
vec3 points[numVerts];
int curVert = 0;
int t;
deltaTheta = (2*M_PI) / numSides;
deltaRho = M_PI / numStacks;
for (curStack=1; curStack<numStacks; curStack++)
{
curRho = (3.141/2.0) - curStack*deltaRho;
curY = sin(curRho) * radius;
curRadius = cos(curRho) * radius;
for (curSlice=0; curSlice<numSides; curSlice++)
{
curTheta = curSlice * deltaTheta;
curX = curRadius * cos(curTheta);
curZ = -curRadius * sin(curTheta);
points[curVert++] = vec3{curX,curY,curZ};
}
}
// option 1 - points only
/*
glBegin(GL_POINTS);
glNormal3d(0,1,0);
glVertex3d(0,radius,0);
for (t=0; t<numVerts; t++)
{
curX = points[t].x;
curY = points[t].y;
curZ = points[t].z;
glNormal3d(curX, curY, curZ);
glVertex3d(curX, curY, curZ);
}
glNormal3d(0,-1,0);
glVertex3d(0,-radius,0);
glEnd();
*/
///////////////////////////////
// option 2 - solid
///////////////////////////////
// part A - draw the top 'lid' (tris)
glBegin(GL_TRIANGLE_FAN);
glNormal3d(0,1,0);
glVertex3d(0,radius,0);
for (t=0; t<numSides; t++)
{
curX = points[t].x;
curY = points[t].y;
curZ = points[t].z;
glNormal3d(curX, curY, curZ);
glVertex3d(curX, curY, curZ);
}
curX = points[0].x;
curY = points[0].y;
curZ = points[0].z;
glNormal3d(curX, curY, curZ);
glVertex3d(curX, curY, curZ);
glEnd();
// part B - draw the 'sides' (quads)
int vertIndex;
for (curStack=0; curStack<numStacks-2; curStack++)
{
vertIndex = curStack * numSides;
glBegin(GL_QUAD_STRIP);
for (curSlice=0; curSlice<numSides; curSlice++)
{
glNormal3d(points[vertIndex+curSlice].x, points[vertIndex+curSlice].y, points[vertIndex+curSlice].z);
glVertex3d(points[vertIndex+curSlice].x, points[vertIndex+curSlice].y, points[vertIndex+curSlice].z);
glNormal3d(points[vertIndex+numSides+curSlice].x, points[vertIndex+numSides+curSlice].y, points[vertIndex+numSides+curSlice].z);
glVertex3d(points[vertIndex+numSides+curSlice].x, points[vertIndex+numSides+curSlice].y, points[vertIndex+numSides+curSlice].z);
}
glNormal3d(points[vertIndex].x, points[vertIndex].y, points[vertIndex].z);
glVertex3d(points[vertIndex].x, points[vertIndex].y, points[vertIndex].z);
glNormal3d(points[vertIndex+numSides].x, points[vertIndex+numSides].y, points[vertIndex+numSides].z);
glVertex3d(points[vertIndex+numSides].x, points[vertIndex+numSides].y, points[vertIndex+numSides].z);
glEnd();
}
// part C - draw the bottom 'lid' (tris)
glBegin(GL_TRIANGLE_FAN);
glNormal3d(0,-1,0);
glVertex3d(0,-radius,0);
for (t=0; t<numSides-1; t++)
{
curX = points[numVerts-1-t].x;
curY = points[numVerts-1-t].y;
curZ = points[numVerts-1-t].z;
glNormal3d(curX, curY, curZ);
glVertex3d(curX, curY, curZ);
}
curX = points[numVerts-1].x;
curY = points[numVerts-1].y;
curZ = points[numVerts-1].z;
glNormal3d(curX, curY, curZ);
glVertex3d(curX, curY, curZ);
glEnd();
}