The scanf function expect pointers to be sent to it so your code should
be...
scanf("%i",&SquadSize);
The reason your program is crashing is because the value currently in
SquadSize is an illegal address. But scanf doesn't know that so it writes to
that illegal area of memory. So the O/S says don't do that and gives you a
virtual slap on the knuckles. O/S are a bit like that they tell you that
you're wrong but rarely why.
Have fun with your future excursions with pointers.
Graeme.
|