Respectful greetings,
This basic C program does not compile in Ubuntu trusty 14.04.1 LTS. The compile line is gcc array.c -std=c99 (the last option for loops). Should I be using ? Is there an iostream for c (and not c++)?
#include <stdio.h>
#include <stdlib.h>
using namespace std;
int main(void)
{
int array[8];
for(int x=0;x<8;x++)
{
std::cin>>array[x];
}
for(int x=0;x<8;x++)
{
std::cout<<array[x];
}
return 0;
}
The error message I get is
array.c:3:3: error: unknown type name ‘using’
using namespace std;
^
array.c:3:19: error: expected ‘=’, ‘,’, ‘;’, ‘asm’ or ‘__attribute__’ before ‘std’
using namespace std;
^
array.c: In function ‘main’:
array.c:9:9: error: expected expression before ‘:’ token
std::cin>>array[x];
^
array.c:13:5: error: duplicate label ‘std’
std::cout<<array[x];
^
array.c:9:5: note: previous definition of ‘std’ was here
std::cin>>array[x];
^
array.c:13:9: error: expected expression before ‘:’ token
std::cout<<array[x];
^
Thanks