How would I go about inserting a space into an array I have gotten, say from a file. exNow where would I go. I don't want to create a new array or use malloc. Is there a way with say pointers or something? TIACode:fgets(array,sizeof array,file);
How would I go about inserting a space into an array I have gotten, say from a file. exNow where would I go. I don't want to create a new array or use malloc. Is there a way with say pointers or something? TIACode:fgets(array,sizeof array,file);
Does the existing array contain enough room?
Since you are using fgets I'm assuming an array of characters and specifically a null terminated array
To say insert a space after the 4th element
This will only work if you have enough room in the array already.Code:for ( c = strlen(array) /* Want to move null character also */; c > 3; c--) { array[c+1] = array[c]; } array[c+1]=' ';