Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- int main()
- {
- // Expand set array size as needed
- int arraySize = 17380;
- char *input = (char*) malloc(sizeof(char) * arraySize);
- char inputChar;
- int arrayIndex = 0;
- while (1)
- {
- inputChar = getchar();
- // break if end of file
- if (inputChar == EOF)
- break;
- // store char in array
- inputArray[arrayIndex] = inputChar;
- arrayIndex++;
- // read char from stdin
- inputChar = getchar();
- printf("Input char:");
- putchar(inputchar);
- printf("\n");
- printf("The array contents are:\n");
- for(int i = 0; i < arrayIndex; i++)
- {
- printf("The array index is: %d\n", arrayIndex);
- printf("%c", inputArray[i]);
- printf( "\n" );
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement