Hi folks.
I'm completely new to C programming.
I installed the DEV C++ IDE compiler (by Bloodshed) on a Windows-XP machine.
(Since I'm new, for now I want to use an IDE environment.)
As a newbie, I noticed that when I click "compile&run" the program-execution-window instantly vanishes after the program runs, which is annoying.
This is only my first day of learning C programming, so I'm sure soon enough I will learn how to make the program execution pause, until the users presses any key.
(I also I know that I can run the .exe file in command line, to stop the output from vanishing, but it's not fun to be using the command line all the time!)
Anyways, in short, to solve this "problem" I "cheated" and found a sample C++ program (not C) in which they use the "<iostream>" library and send a "pause" command to Windows-XP, to stop the window from vanishing.
I tried it with my C program, to see if it also works in C, and it does!
But... I'm wondering 3 things about this:
1) Am I "allowed" to use the <iostream> library in C programs, or was that "iostream" library really just intended for C++?
2) Since it compiles and runs, then I guess it's ok to use that library for now, and it must have been made for C usage as well?
Using the <iostream> library to solve this problem kinda feels like "cheating" since I'm using the operating system to keep the window open, rather than figuring out how to do that within C itself.
But again, today is only my first day... so I'll figure it out soon enough. So until then, this is how my C code looks when I use that library:
#include <stdio.h>
#include <iostream>
int main()
{
printf("Hello.\n");
system("PAUSE");
}
So it seems like the <iostream> library allows me to send commands to windows, such as "pause".