i tried to transform this loop
Code:printf("enter string\n"); for (i = 0; i < 39 && (ch = getchar()) != '\n' && ch >=0; ++i) { input2[i] = ch; } input2[i] = '\0'; */
but its not runningCode:#include <stdio.h> void read(input2,i); int main() { int input2[40]; read(input2,0); } void read(input2,i) { char ch; if (i==39) { input2[i] = '\0'; return ; } if ((i<39)&&( (ch = getchar()) != '\n') &&( ch >=0)) { input2[i] = ch; } read(input2,i+1); }
its giving me two errors like
(13) : error C2109: subscript requires array or pointer type
why??
(in the edit scren its perfectly intended but when i save it gives me what you see)