Home > Back-end > C language compiler running string output is the result of the white square is what's going on
C language compiler running string output is the result of the white square is what's going on
Time:03-07
CodePudding user response:
Should be a string, not the end of the character '\ 0', Suggest check whether add don't add after effective string '\ 0',
In addition, also recommends to the code,
CodePudding user response:
Code is wrong so
So ask someone else can answer you
CodePudding user response:
Maybe it's the array of what don't memory allocation is not initialized
CodePudding user response:
This is the code # include # define MAXLINE 1000 Int getline (char line [], int maxline); Void copy (char to [], char from []); The main () { Int len. Int Max; Char line [MAXLINE]; Char longest [MAXLINE]; Max=0; While ((len=getline (line, MAXLINE)) & gt; 0) If (len> Max) { Max=len; Copy (longest, line); } If (max> 0) Printf (" % s ", the longest); return 0; } Int getline (char [s], int lim) { C, int I; for(i=0; iS [I]=c; If (c=='\ n') { S [I]=c; + + I; } S [I]='\ 0'; return i; } Void copy (char to [], char from []) { int i; i=0; While ((to [I]=the from [I]!='\ 0')) + + I; }