Welcome to the new platform of Programmers Heaven! We apologize for the inconvenience caused, if you visited us from a broken link of the previous version. The main reason to move to a new platform is to provide more effective and collaborative experience to you all. Please feel free to experience the new platform and use it's exciting features. Contact us for any issue that you need to get clarified. We are more than happy to help you.
Help with scanf and arrays
I am currently learning C and have come across an issue I cannot find an answer anywhere. Basically I want an input of 10 digits (all in one singular input) and scan each number into an array.
Let me clarify a little more with the code:
int i, a;
printf("Please enter the 10 digits (sith spaces in between) (Y Y M M D D X X X X) : ");
for (i=0; i<N; i++)
Basically I want the user to input 10 digits and then have those numbers scanned into an array. I don't want to do it the easy way of having the user type 1 digit at a time followed by hitting the enter key every time.
However this code of mine gives a "segmentation fault." So I assume I'm doing something wrong.
Any help appreciated!