[Solved] Basic c program not compiling in Ubuntu trusty [closed]


This is not a C program, it is a C++ program. Rename your file to array.cpp and/or use g++ instead of gcc, and no, there is no such thing as iostream in C.

The first non-C part of your program is

using namespace std;

there is no namespaces in C.

the second part is

std:cin>>array[x];

there are two things wrong with it, first of all why do using namespace std; and then std::cin if you use using namespace in C++ it means that it will lookup in that namespace when omited, secondly that is also C++ specific. There is no stream operator in C.

You included stdio.h so you have to use fgets or similar functions. And for output the printf family

2

solved Basic c program not compiling in Ubuntu trusty [closed]