I want to have a user enter numbers separated by a space and then store each value as an element of an array. Currently I have:
while ((c = getchar()) != \'\
scanf returns the number of items successfully scanned. Give this code a try:
scanf
#include int main() { int arr[500]; int i = 0; int sc = 0; //scanned items int n = 3; // no of integers to be scanned from the single line in stdin while( sc