c - Strange characters at the end of string -


i want fill string '_' have

while (i < length) {   myword[i] = 95;   i++; } 

length const int typed user. when type printf("%s",myword); it's output '____#s' or '____#' or it's output good.

where problem? thank :)

a string must end \0 char

while (i < length) {   myword[i] = 95;   i++; } myworkd[i] = 0; 

Comments

Popular posts from this blog

android - Get AccessToken using signpost OAuth without opening a browser (Two legged Oauth) -

org.mockito.exceptions.misusing.InvalidUseOfMatchersException: mockito -

google shop client API returns 400 bad request error while adding an item -