You have this declaration:
char ,,,, *no;
And then you have this line:
sprintf( no, "%d", n);
Nowhere in the code do you allocate memory for no
. This leads to undefined behavior as uninitialized local variables have indeterminate values, and you are writing out into seemingly random memory.
I don't know it this is the cause of your problem, but undefined behavior can cause all kind of weird symptoms.
You either need to use e.g. malloc
to allocate memory for the variable, or make it an array (of ten characters, as that's what you write
later).