There's no way to say what you are doing wrong without seeing the whole thing.
The above sprintf
should work, although strcpy
would make more sense for that purpose. I'd guess that sprintf
works fine. Could be that your a
array is not "full of A's" as you believe, but rather an empty string (full of zeros). Or maybe it is your printing that either doesn't work or it works but you don't see the output for some reason.
My bet would be that your a
is an empty string. No A's there. Where and how do you put those A's into the a
array?