Quantcast
Channel: Save whole input in integer array (read with getchar) - Stack Overflow
Browsing index pages (2 articles)

Save whole input in integer array (read with getchar)

I'm only allowed to use the stdio.h library. So I want to read the user input with getchar until the first "/" and then want to save the read input in an integer array. Checking the input out of the...

View Article


Answer by Paul Ogilvie for Save whole input in integer array (read with getchar)

See the comments as to the why, but the following is correct: int main() { count= 0; while (count<49) { i = getchar(); if (i == '/') break; safe[count++] = i; } safe[count]= '\0'; }

View Article

Browsing index pages (2 articles)


Latest Images