Ok, am convinced there is nothing wrong with this code. But i wonder why it won't compile in code::blocks or g++.
Here is the code:
// This program prints its environment variables.
#include <iostream>
using namespace std;
int main(int argc, char** argv)
{
extern char **environ; // Needed to access the environment
int k = 0;
while(environ[k] != 0) // Is it last C-string in environment?
{
// Print the string
cout << environ[k] << "\n";
k++;
}
return 0;
}