string array with garbage character at end
问题 I have a char array buffer that I am using to store characters that the user will input one by one. My code below works but has a few glitches that I can't figure out: when I execute a printf to see what's in Buffer, it does fill up but I get garbage characters at the end it won't stop at 8 characters despite being declared as char Buffer[8]; Can somebody please explain to me what is going on and perhaps how I could fix this? Thanks. char Buffer[8]; //holds the byte stream int i=0; if (/*