I m a beginner at this trying to learn C, I have this .pdf c-in-7-days where
told me to work on dev-C++. I have the version 4.9.9.2 and win7 as OS. I can't
understand why this code:
include <stdio.h>
main()
{
printf("hello world!\n");
system("pause"); //this line is only needed under windows
}
is working for the first time I used it and not in the other times I want to
use?
it keeps giving me the same error about the system line as being undeclared.
when I compile, it puts an x mark on the left of the line and at the bottom
gives these messages:
in function 'int main()':
'system' undeclared (first use this function)
(Each undeclared identifier is reported only once for each function it appears
in.)
I can't figure out a way to solve this since I've only began today.
I would be grateful if you help me! Thanks...
If you would like to refer to this comment somewhere else in this project, copy and paste the following link:
If that is truly what the document you referred you suggested as initial code,
then discard it. It is astounding how many errors, bad-practice, and
misinformation you can cram into six lines of code. Get a better reference.
For that matter, a better development tool would help. The recommendation to
use Dev-C++ may be indicative of the age of the material you are using; there
are now better choices than perhaps when that was written.
#include<stdio.h>#include<stdlib.h> // where system() function is declaredintmain()// The only mandated return type for main() in C is int{printf("hello world!\n");system("pause");// Required to prevent the application from terminating // immediately causing the OS to close its window.return0;}
If you would like to refer to this comment somewhere else in this project, copy and paste the following link:
hi!
I m a beginner at this trying to learn C, I have this .pdf c-in-7-days where
told me to work on dev-C++. I have the version 4.9.9.2 and win7 as OS. I can't
understand why this code:
include <stdio.h>
main()
{
printf("hello world!\n");
system("pause"); //this line is only needed under windows
}
is working for the first time I used it and not in the other times I want to
use?
it keeps giving me the same error about the system line as being undeclared.
when I compile, it puts an x mark on the left of the line and at the bottom
gives these messages:
in function 'int main()':
'system' undeclared (first use this function)
(Each undeclared identifier is reported only once for each function it appears
in.)
I can't figure out a way to solve this since I've only began today.
I would be grateful if you help me! Thanks...
If that is truly what the document you referred you suggested as initial code,
then discard it. It is astounding how many errors, bad-practice, and
misinformation you can cram into six lines of code. Get a better reference.
For that matter, a better development tool would help. The recommendation to
use Dev-C++ may be indicative of the age of the material you are using; there
are now better choices than perhaps when that was written.