s is allocated inside the function and will not exist after the function has returned, so in main() you get a dangling pointer. There are several ways to solve this. One way is to dynamic allocate the array char* s = newchar;;
The while loop condition should probably be while(a != 0) because otherwise you ignore the last digit.
line 8 is also not correct. The char '0' is not the same as the int 0. You just need to add the value of '0' to the digit value to make it correct: s[i] = '0' + (a%10);
When you print the string on line 21 you should remove the * or otherwise you will only print the first char in the string.