Hey guys I want to take 7 numbers from the user, preferrably into an array. The problem is I want the numbers to be able to be taken regardless of whitespace, so 1234567
should be the same as 123 45 6 7
and etc..
I currently have this code that works but was wondering if there is an easier or more efficient way I could do this, perhaps by taking input with scanf()
then removing the spaces later? Thanks!
while(i<7){
temp = getchar();
if(temp != ' '){
arr[i] = temp;
i++;
}
}