What can replace cin >> a [i] in objective c?

    2 answers 2

    Objective-C is an add-on over C, so all I / O operations from the standard library of the latter will work:

    int x = 0; scanf("%d", &x); 

      You can use C ++, for this you need to use a file with *.mm_ instead of *.m , thus telling the compiler that you are using C ++ syntactic constructions (more detailed information can be found in nete, for example, in the apple help, which I think one of the most informative).

      If you want to use pure C then use functions of the lib, ala stdio.h

      run.mm: (C ++)

       #include <iostream> int main() { int a; std::cin >> a; std::cout << a + 1; } 

      run.m: (c)

       #include <stdio.h> int main() { int a; scanf("%d", &a); printf("%d", a+1); }