So to start, I'll just give brief overview of how skeletal animation works, which will lead in nicely to how a skeleton is applied to a mesh.
Character animation can be defined as the deformation of the 'skin,' or geometry that makes up the character, over time. The extremely naive way of accomplishing this is to individually move and keyframe each vertex in the model. This would results in the most control and perhaps visually appealing results, but it would also take forever for an animator to do his job. So the skeleton method was established (note that there are also other ways to animate such as implicit functions, but the skeleton method is most convenient for games).
Each joint of a skeleton exerts a certain amount of influence over the vertices of a mesh, and is represented as a matrix which will perform a linear transformation. In a rigid bind, a vertex can only be influenced by one joint. This is good for a robotic character, but for a humanoid character, we need smooth skinning, where a vertex can be influenced by multiple joints. And to calculate new positions of vertices as the joints move, we linearly interpolate between the new positions of the vertices calculated by multiplying by the matrix of each joint that influences them, and weighted by the amount of influence of those joints.
For more information, a good starting point is the Wikipedia article on the subject.
Now, given all that, your goal is to calculate what joints influence each vertex, and with what weights. The reason I suggested using modeling software which already does this for you (Maya, 3DS Max, etc.), is because this is quite a hard problem to do properly in one go, but all the same it's probably fun to try to implement.
What you need to do is for each vertex, figure out, perhaps, which joints are closest to it, and depending on their distance, assign a weight to that joint for that particular vertex. There are problems that come up though. For example, what if when you skin the model, the wrist joints are close to the hips (the characters arms are hanging)? The result will be that the vertices of the hip are now influenced by the wrist joint, and when you move the model's arm outwards, the hip will deform awkwardly. A naive way to remedy this might be to raycast between each vertex and potential influencing joint, and if there is an obstruction (i.e, the ray does not travel entirely inside of the model), then that joint cannot influence that vertex. Again, this is not true in all cases, and finding a general solution is difficult.
Furthermore, there are difficulties in assigning weights to joints appropriately. Even professional grade modeling and rigging software, such as Maya, cannot do this perfectly, and this is why the job of weight painting exists. Other skinning algorithms, such as Dual Quaternion Skinning, alleviate the need for this, but do not eliminate it entirely.
A couple of additional implementation notes: the sum of the weights on joints for a particular vertex must be 1. Also, the typical number of joints that influence a single vertex in the industry these days is 4.
In sum, the concept of applying a skeleton to a model is quite easy to grasp and implement at its most basic level, but the details and corner cases of doing it properly are what makes it such a hard problem.
Hope this helps, and good luck :)