Just wondering what is Exactly Wrong With My Code C programming











up vote
-4
down vote

favorite












i have no idea what is wrong with my code i am using visual studio and it says that i dont have an identifier and im not 100% sure what it means im basically having to write a new function for pow i didnt really understand it to much but if someone could look at my code it would be really helpful thank you



// Programmer:     Your Name
// Date: Date
// Program Name: The name of the program
// Chapter: Chapter # - Chapter name
// Description: 2 complete English sentences describing what the program does,
// algorithm used, etc.
#define _CRT_SECURE_NO_WARNINGS // Disable warnings (and errors) when using non-secure versions of printf, scanf, strcpy, etc.
#include <stdio.h> // Needed for working with printf and scanf
#include <math.h>
#include <string.h>

int main(void)
{
// Constant and Variable Declarations
double power(double num, int power) {
double result = 1;
if (power > 0) {
int i = 0;
for (i = 0; i < power; i++) {
result *= num;
}
return result;
}
else {
if (power < 0) {
power *= -1;
int i = 0;
for (i = 0; i < power; i++) {
result *= num;
}
}
return 1 / result;
}
}
int main(void)
{
double number;
int p;
printf("Enter a number to raise to a power : ");
scanf("%lf", &number);
printf("Enter the power to raise %.2lf to : ", number);
scanf("%d", &p);
printf("%.2f raised to the power of %d is : ", p);
double result = power(number, p);
double mathPow = pow(number, p);
printf("n%-20s%-20sn", "My Function", "Pow() Function");
printf("%-20.2f%-20.2fn", result, mathPow);
return 0;
}
// *** Your program goes here ***
return 0;
} // end main()









share|improve this question




















  • 2




    Please read the help pages, take the SO tour, read about how to ask good questions, as well as this question checklist. Lastly please copy-paste the full and complete output of the compiler (as text!) into the question body.
    – Some programmer dude
    Nov 11 at 19:31








  • 4




    Why do you have 2 int main(void)? And what is the exact error message?
    – UnholySheep
    Nov 11 at 19:31






  • 1




    And there are a lot of errors in your code. Do you come from a Pascal or Delphi background, or some other language where nested functions are allowed? Because in C it's not. Perhaps you should take many steps back, get yourself a few beginners books, and start all over from the very beginning?
    – Some programmer dude
    Nov 11 at 19:37






  • 3




    This quite-literally looks like you found someone's working example, then slammed it in a C boilerplate, in its entirety, where the "Your program goes here" comment is suspiciously present. Sorry to be the bearer of bad news, but sooner or later you're going to have to write code; not just find it.
    – WhozCraig
    Nov 11 at 20:08















up vote
-4
down vote

favorite












i have no idea what is wrong with my code i am using visual studio and it says that i dont have an identifier and im not 100% sure what it means im basically having to write a new function for pow i didnt really understand it to much but if someone could look at my code it would be really helpful thank you



// Programmer:     Your Name
// Date: Date
// Program Name: The name of the program
// Chapter: Chapter # - Chapter name
// Description: 2 complete English sentences describing what the program does,
// algorithm used, etc.
#define _CRT_SECURE_NO_WARNINGS // Disable warnings (and errors) when using non-secure versions of printf, scanf, strcpy, etc.
#include <stdio.h> // Needed for working with printf and scanf
#include <math.h>
#include <string.h>

int main(void)
{
// Constant and Variable Declarations
double power(double num, int power) {
double result = 1;
if (power > 0) {
int i = 0;
for (i = 0; i < power; i++) {
result *= num;
}
return result;
}
else {
if (power < 0) {
power *= -1;
int i = 0;
for (i = 0; i < power; i++) {
result *= num;
}
}
return 1 / result;
}
}
int main(void)
{
double number;
int p;
printf("Enter a number to raise to a power : ");
scanf("%lf", &number);
printf("Enter the power to raise %.2lf to : ", number);
scanf("%d", &p);
printf("%.2f raised to the power of %d is : ", p);
double result = power(number, p);
double mathPow = pow(number, p);
printf("n%-20s%-20sn", "My Function", "Pow() Function");
printf("%-20.2f%-20.2fn", result, mathPow);
return 0;
}
// *** Your program goes here ***
return 0;
} // end main()









share|improve this question




















  • 2




    Please read the help pages, take the SO tour, read about how to ask good questions, as well as this question checklist. Lastly please copy-paste the full and complete output of the compiler (as text!) into the question body.
    – Some programmer dude
    Nov 11 at 19:31








  • 4




    Why do you have 2 int main(void)? And what is the exact error message?
    – UnholySheep
    Nov 11 at 19:31






  • 1




    And there are a lot of errors in your code. Do you come from a Pascal or Delphi background, or some other language where nested functions are allowed? Because in C it's not. Perhaps you should take many steps back, get yourself a few beginners books, and start all over from the very beginning?
    – Some programmer dude
    Nov 11 at 19:37






  • 3




    This quite-literally looks like you found someone's working example, then slammed it in a C boilerplate, in its entirety, where the "Your program goes here" comment is suspiciously present. Sorry to be the bearer of bad news, but sooner or later you're going to have to write code; not just find it.
    – WhozCraig
    Nov 11 at 20:08













up vote
-4
down vote

favorite









up vote
-4
down vote

favorite











i have no idea what is wrong with my code i am using visual studio and it says that i dont have an identifier and im not 100% sure what it means im basically having to write a new function for pow i didnt really understand it to much but if someone could look at my code it would be really helpful thank you



// Programmer:     Your Name
// Date: Date
// Program Name: The name of the program
// Chapter: Chapter # - Chapter name
// Description: 2 complete English sentences describing what the program does,
// algorithm used, etc.
#define _CRT_SECURE_NO_WARNINGS // Disable warnings (and errors) when using non-secure versions of printf, scanf, strcpy, etc.
#include <stdio.h> // Needed for working with printf and scanf
#include <math.h>
#include <string.h>

int main(void)
{
// Constant and Variable Declarations
double power(double num, int power) {
double result = 1;
if (power > 0) {
int i = 0;
for (i = 0; i < power; i++) {
result *= num;
}
return result;
}
else {
if (power < 0) {
power *= -1;
int i = 0;
for (i = 0; i < power; i++) {
result *= num;
}
}
return 1 / result;
}
}
int main(void)
{
double number;
int p;
printf("Enter a number to raise to a power : ");
scanf("%lf", &number);
printf("Enter the power to raise %.2lf to : ", number);
scanf("%d", &p);
printf("%.2f raised to the power of %d is : ", p);
double result = power(number, p);
double mathPow = pow(number, p);
printf("n%-20s%-20sn", "My Function", "Pow() Function");
printf("%-20.2f%-20.2fn", result, mathPow);
return 0;
}
// *** Your program goes here ***
return 0;
} // end main()









share|improve this question















i have no idea what is wrong with my code i am using visual studio and it says that i dont have an identifier and im not 100% sure what it means im basically having to write a new function for pow i didnt really understand it to much but if someone could look at my code it would be really helpful thank you



// Programmer:     Your Name
// Date: Date
// Program Name: The name of the program
// Chapter: Chapter # - Chapter name
// Description: 2 complete English sentences describing what the program does,
// algorithm used, etc.
#define _CRT_SECURE_NO_WARNINGS // Disable warnings (and errors) when using non-secure versions of printf, scanf, strcpy, etc.
#include <stdio.h> // Needed for working with printf and scanf
#include <math.h>
#include <string.h>

int main(void)
{
// Constant and Variable Declarations
double power(double num, int power) {
double result = 1;
if (power > 0) {
int i = 0;
for (i = 0; i < power; i++) {
result *= num;
}
return result;
}
else {
if (power < 0) {
power *= -1;
int i = 0;
for (i = 0; i < power; i++) {
result *= num;
}
}
return 1 / result;
}
}
int main(void)
{
double number;
int p;
printf("Enter a number to raise to a power : ");
scanf("%lf", &number);
printf("Enter the power to raise %.2lf to : ", number);
scanf("%d", &p);
printf("%.2f raised to the power of %d is : ", p);
double result = power(number, p);
double mathPow = pow(number, p);
printf("n%-20s%-20sn", "My Function", "Pow() Function");
printf("%-20.2f%-20.2fn", result, mathPow);
return 0;
}
// *** Your program goes here ***
return 0;
} // end main()






c






share|improve this question















share|improve this question













share|improve this question




share|improve this question








edited Nov 11 at 19:35









Schwern

87.7k16101229




87.7k16101229










asked Nov 11 at 19:29









Gnrhellraiser

41




41








  • 2




    Please read the help pages, take the SO tour, read about how to ask good questions, as well as this question checklist. Lastly please copy-paste the full and complete output of the compiler (as text!) into the question body.
    – Some programmer dude
    Nov 11 at 19:31








  • 4




    Why do you have 2 int main(void)? And what is the exact error message?
    – UnholySheep
    Nov 11 at 19:31






  • 1




    And there are a lot of errors in your code. Do you come from a Pascal or Delphi background, or some other language where nested functions are allowed? Because in C it's not. Perhaps you should take many steps back, get yourself a few beginners books, and start all over from the very beginning?
    – Some programmer dude
    Nov 11 at 19:37






  • 3




    This quite-literally looks like you found someone's working example, then slammed it in a C boilerplate, in its entirety, where the "Your program goes here" comment is suspiciously present. Sorry to be the bearer of bad news, but sooner or later you're going to have to write code; not just find it.
    – WhozCraig
    Nov 11 at 20:08














  • 2




    Please read the help pages, take the SO tour, read about how to ask good questions, as well as this question checklist. Lastly please copy-paste the full and complete output of the compiler (as text!) into the question body.
    – Some programmer dude
    Nov 11 at 19:31








  • 4




    Why do you have 2 int main(void)? And what is the exact error message?
    – UnholySheep
    Nov 11 at 19:31






  • 1




    And there are a lot of errors in your code. Do you come from a Pascal or Delphi background, or some other language where nested functions are allowed? Because in C it's not. Perhaps you should take many steps back, get yourself a few beginners books, and start all over from the very beginning?
    – Some programmer dude
    Nov 11 at 19:37






  • 3




    This quite-literally looks like you found someone's working example, then slammed it in a C boilerplate, in its entirety, where the "Your program goes here" comment is suspiciously present. Sorry to be the bearer of bad news, but sooner or later you're going to have to write code; not just find it.
    – WhozCraig
    Nov 11 at 20:08








2




2




Please read the help pages, take the SO tour, read about how to ask good questions, as well as this question checklist. Lastly please copy-paste the full and complete output of the compiler (as text!) into the question body.
– Some programmer dude
Nov 11 at 19:31






Please read the help pages, take the SO tour, read about how to ask good questions, as well as this question checklist. Lastly please copy-paste the full and complete output of the compiler (as text!) into the question body.
– Some programmer dude
Nov 11 at 19:31






4




4




Why do you have 2 int main(void)? And what is the exact error message?
– UnholySheep
Nov 11 at 19:31




Why do you have 2 int main(void)? And what is the exact error message?
– UnholySheep
Nov 11 at 19:31




1




1




And there are a lot of errors in your code. Do you come from a Pascal or Delphi background, or some other language where nested functions are allowed? Because in C it's not. Perhaps you should take many steps back, get yourself a few beginners books, and start all over from the very beginning?
– Some programmer dude
Nov 11 at 19:37




And there are a lot of errors in your code. Do you come from a Pascal or Delphi background, or some other language where nested functions are allowed? Because in C it's not. Perhaps you should take many steps back, get yourself a few beginners books, and start all over from the very beginning?
– Some programmer dude
Nov 11 at 19:37




3




3




This quite-literally looks like you found someone's working example, then slammed it in a C boilerplate, in its entirety, where the "Your program goes here" comment is suspiciously present. Sorry to be the bearer of bad news, but sooner or later you're going to have to write code; not just find it.
– WhozCraig
Nov 11 at 20:08




This quite-literally looks like you found someone's working example, then slammed it in a C boilerplate, in its entirety, where the "Your program goes here" comment is suspiciously present. Sorry to be the bearer of bad news, but sooner or later you're going to have to write code; not just find it.
– WhozCraig
Nov 11 at 20:08












1 Answer
1






active

oldest

votes

















up vote
-1
down vote













You can't (or at least shouldn't) define functions inside functions in C.



cc -Wall -Wshadow -Wwrite-strings -Wextra -Wconversion -std=c99 -pedantic -g `pkg-config --cflags glib-2.0`   -c -o test.o test.c
test.c:15:41: error: function definition is not allowed here
double power(double num, int power) {
^
test.c:36:5: error: function definition is not allowed here
{
^


And you have two main functions. main is the function which gets run by the operating system when the program is run. You only need one.



There's a couple other problems...



test.c:41:52: warning: format specifies type 'double' but the argument has type 'int' [-Wformat]
printf("%.2f raised to the power of %d is : ", p);
~~~~ ^
%.2d
test.c:41:42: warning: more '%' conversions than data arguments [-Wformat]
printf("%.2f raised to the power of %d is : ", p);


That printf is missing an argument. It should be...



printf("%.2f raised to the power of %d is : ", number, p);


With those fixes it works fine.





You can DRY up power by defining a second function just for positive numbers.



double power_positive(double num, int power) {
int i = 0;
double result = 1;
for (i = 0; i < power; i++) {
result *= num;
}
return result;
}

double power(double num, int power) {
if (power < 0) {
return 1 / power_positive(num, -power);
}
else {
return power_positive(num, power);
}
}





share|improve this answer























  • The operating system does not call main. The program loader initiates execution at the executable’s start address, which is typically at a symbol such as start. The code there initializes the C environment and then calls main.
    – Eric Postpischil
    Nov 11 at 19:51








  • 1




    @EricPostpischil I'm sure that difference is irrelevant for OP at his current level of understanding.
    – Geier
    Nov 11 at 20:07






  • 1




    @Geier: The fact they are unable to detect the falsehood now does not mean you have not planted in their mind a false statement that will lead to confusion later in their education. You can easily edit your answer to use solely true statements, with various degrees of detail you choose, such as “main is the entry point for your program, and only one main routine should be defined.”
    – Eric Postpischil
    Nov 11 at 20:24












  • @EricPostpischil That's not my answer.
    – Geier
    Nov 11 at 20:32










  • @EricPostpischil Welcome to your first day of driver's ed. Move the transmission control lever from P to D. This will remove the parking pawl and allow the fluid coupler to transmit power from the engine to the planetary gears inside the transmission delivering power from the engine to the crankshaft at various gear ratios. Then depress the accelerator pedal which will inform the fuel injection system to supply an increased fuel/air mixture to the cylinders of the engine supplying more power to the transmission, crankshaft, and wheels. Now merge onto the freeway.
    – Schwern
    Nov 11 at 20:52













Your Answer






StackExchange.ifUsing("editor", function () {
StackExchange.using("externalEditor", function () {
StackExchange.using("snippets", function () {
StackExchange.snippets.init();
});
});
}, "code-snippets");

StackExchange.ready(function() {
var channelOptions = {
tags: "".split(" "),
id: "1"
};
initTagRenderer("".split(" "), "".split(" "), channelOptions);

StackExchange.using("externalEditor", function() {
// Have to fire editor after snippets, if snippets enabled
if (StackExchange.settings.snippets.snippetsEnabled) {
StackExchange.using("snippets", function() {
createEditor();
});
}
else {
createEditor();
}
});

function createEditor() {
StackExchange.prepareEditor({
heartbeatType: 'answer',
convertImagesToLinks: true,
noModals: true,
showLowRepImageUploadWarning: true,
reputationToPostImages: 10,
bindNavPrevention: true,
postfix: "",
imageUploader: {
brandingHtml: "Powered by u003ca class="icon-imgur-white" href="https://imgur.com/"u003eu003c/au003e",
contentPolicyHtml: "User contributions licensed under u003ca href="https://creativecommons.org/licenses/by-sa/3.0/"u003ecc by-sa 3.0 with attribution requiredu003c/au003e u003ca href="https://stackoverflow.com/legal/content-policy"u003e(content policy)u003c/au003e",
allowUrls: true
},
onDemand: true,
discardSelector: ".discard-answer"
,immediatelyShowMarkdownHelp:true
});


}
});














draft saved

draft discarded


















StackExchange.ready(
function () {
StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2fstackoverflow.com%2fquestions%2f53252397%2fjust-wondering-what-is-exactly-wrong-with-my-code-c-programming%23new-answer', 'question_page');
}
);

Post as a guest















Required, but never shown

























1 Answer
1






active

oldest

votes








1 Answer
1






active

oldest

votes









active

oldest

votes






active

oldest

votes








up vote
-1
down vote













You can't (or at least shouldn't) define functions inside functions in C.



cc -Wall -Wshadow -Wwrite-strings -Wextra -Wconversion -std=c99 -pedantic -g `pkg-config --cflags glib-2.0`   -c -o test.o test.c
test.c:15:41: error: function definition is not allowed here
double power(double num, int power) {
^
test.c:36:5: error: function definition is not allowed here
{
^


And you have two main functions. main is the function which gets run by the operating system when the program is run. You only need one.



There's a couple other problems...



test.c:41:52: warning: format specifies type 'double' but the argument has type 'int' [-Wformat]
printf("%.2f raised to the power of %d is : ", p);
~~~~ ^
%.2d
test.c:41:42: warning: more '%' conversions than data arguments [-Wformat]
printf("%.2f raised to the power of %d is : ", p);


That printf is missing an argument. It should be...



printf("%.2f raised to the power of %d is : ", number, p);


With those fixes it works fine.





You can DRY up power by defining a second function just for positive numbers.



double power_positive(double num, int power) {
int i = 0;
double result = 1;
for (i = 0; i < power; i++) {
result *= num;
}
return result;
}

double power(double num, int power) {
if (power < 0) {
return 1 / power_positive(num, -power);
}
else {
return power_positive(num, power);
}
}





share|improve this answer























  • The operating system does not call main. The program loader initiates execution at the executable’s start address, which is typically at a symbol such as start. The code there initializes the C environment and then calls main.
    – Eric Postpischil
    Nov 11 at 19:51








  • 1




    @EricPostpischil I'm sure that difference is irrelevant for OP at his current level of understanding.
    – Geier
    Nov 11 at 20:07






  • 1




    @Geier: The fact they are unable to detect the falsehood now does not mean you have not planted in their mind a false statement that will lead to confusion later in their education. You can easily edit your answer to use solely true statements, with various degrees of detail you choose, such as “main is the entry point for your program, and only one main routine should be defined.”
    – Eric Postpischil
    Nov 11 at 20:24












  • @EricPostpischil That's not my answer.
    – Geier
    Nov 11 at 20:32










  • @EricPostpischil Welcome to your first day of driver's ed. Move the transmission control lever from P to D. This will remove the parking pawl and allow the fluid coupler to transmit power from the engine to the planetary gears inside the transmission delivering power from the engine to the crankshaft at various gear ratios. Then depress the accelerator pedal which will inform the fuel injection system to supply an increased fuel/air mixture to the cylinders of the engine supplying more power to the transmission, crankshaft, and wheels. Now merge onto the freeway.
    – Schwern
    Nov 11 at 20:52

















up vote
-1
down vote













You can't (or at least shouldn't) define functions inside functions in C.



cc -Wall -Wshadow -Wwrite-strings -Wextra -Wconversion -std=c99 -pedantic -g `pkg-config --cflags glib-2.0`   -c -o test.o test.c
test.c:15:41: error: function definition is not allowed here
double power(double num, int power) {
^
test.c:36:5: error: function definition is not allowed here
{
^


And you have two main functions. main is the function which gets run by the operating system when the program is run. You only need one.



There's a couple other problems...



test.c:41:52: warning: format specifies type 'double' but the argument has type 'int' [-Wformat]
printf("%.2f raised to the power of %d is : ", p);
~~~~ ^
%.2d
test.c:41:42: warning: more '%' conversions than data arguments [-Wformat]
printf("%.2f raised to the power of %d is : ", p);


That printf is missing an argument. It should be...



printf("%.2f raised to the power of %d is : ", number, p);


With those fixes it works fine.





You can DRY up power by defining a second function just for positive numbers.



double power_positive(double num, int power) {
int i = 0;
double result = 1;
for (i = 0; i < power; i++) {
result *= num;
}
return result;
}

double power(double num, int power) {
if (power < 0) {
return 1 / power_positive(num, -power);
}
else {
return power_positive(num, power);
}
}





share|improve this answer























  • The operating system does not call main. The program loader initiates execution at the executable’s start address, which is typically at a symbol such as start. The code there initializes the C environment and then calls main.
    – Eric Postpischil
    Nov 11 at 19:51








  • 1




    @EricPostpischil I'm sure that difference is irrelevant for OP at his current level of understanding.
    – Geier
    Nov 11 at 20:07






  • 1




    @Geier: The fact they are unable to detect the falsehood now does not mean you have not planted in their mind a false statement that will lead to confusion later in their education. You can easily edit your answer to use solely true statements, with various degrees of detail you choose, such as “main is the entry point for your program, and only one main routine should be defined.”
    – Eric Postpischil
    Nov 11 at 20:24












  • @EricPostpischil That's not my answer.
    – Geier
    Nov 11 at 20:32










  • @EricPostpischil Welcome to your first day of driver's ed. Move the transmission control lever from P to D. This will remove the parking pawl and allow the fluid coupler to transmit power from the engine to the planetary gears inside the transmission delivering power from the engine to the crankshaft at various gear ratios. Then depress the accelerator pedal which will inform the fuel injection system to supply an increased fuel/air mixture to the cylinders of the engine supplying more power to the transmission, crankshaft, and wheels. Now merge onto the freeway.
    – Schwern
    Nov 11 at 20:52















up vote
-1
down vote










up vote
-1
down vote









You can't (or at least shouldn't) define functions inside functions in C.



cc -Wall -Wshadow -Wwrite-strings -Wextra -Wconversion -std=c99 -pedantic -g `pkg-config --cflags glib-2.0`   -c -o test.o test.c
test.c:15:41: error: function definition is not allowed here
double power(double num, int power) {
^
test.c:36:5: error: function definition is not allowed here
{
^


And you have two main functions. main is the function which gets run by the operating system when the program is run. You only need one.



There's a couple other problems...



test.c:41:52: warning: format specifies type 'double' but the argument has type 'int' [-Wformat]
printf("%.2f raised to the power of %d is : ", p);
~~~~ ^
%.2d
test.c:41:42: warning: more '%' conversions than data arguments [-Wformat]
printf("%.2f raised to the power of %d is : ", p);


That printf is missing an argument. It should be...



printf("%.2f raised to the power of %d is : ", number, p);


With those fixes it works fine.





You can DRY up power by defining a second function just for positive numbers.



double power_positive(double num, int power) {
int i = 0;
double result = 1;
for (i = 0; i < power; i++) {
result *= num;
}
return result;
}

double power(double num, int power) {
if (power < 0) {
return 1 / power_positive(num, -power);
}
else {
return power_positive(num, power);
}
}





share|improve this answer














You can't (or at least shouldn't) define functions inside functions in C.



cc -Wall -Wshadow -Wwrite-strings -Wextra -Wconversion -std=c99 -pedantic -g `pkg-config --cflags glib-2.0`   -c -o test.o test.c
test.c:15:41: error: function definition is not allowed here
double power(double num, int power) {
^
test.c:36:5: error: function definition is not allowed here
{
^


And you have two main functions. main is the function which gets run by the operating system when the program is run. You only need one.



There's a couple other problems...



test.c:41:52: warning: format specifies type 'double' but the argument has type 'int' [-Wformat]
printf("%.2f raised to the power of %d is : ", p);
~~~~ ^
%.2d
test.c:41:42: warning: more '%' conversions than data arguments [-Wformat]
printf("%.2f raised to the power of %d is : ", p);


That printf is missing an argument. It should be...



printf("%.2f raised to the power of %d is : ", number, p);


With those fixes it works fine.





You can DRY up power by defining a second function just for positive numbers.



double power_positive(double num, int power) {
int i = 0;
double result = 1;
for (i = 0; i < power; i++) {
result *= num;
}
return result;
}

double power(double num, int power) {
if (power < 0) {
return 1 / power_positive(num, -power);
}
else {
return power_positive(num, power);
}
}






share|improve this answer














share|improve this answer



share|improve this answer








edited Nov 11 at 19:48

























answered Nov 11 at 19:41









Schwern

87.7k16101229




87.7k16101229












  • The operating system does not call main. The program loader initiates execution at the executable’s start address, which is typically at a symbol such as start. The code there initializes the C environment and then calls main.
    – Eric Postpischil
    Nov 11 at 19:51








  • 1




    @EricPostpischil I'm sure that difference is irrelevant for OP at his current level of understanding.
    – Geier
    Nov 11 at 20:07






  • 1




    @Geier: The fact they are unable to detect the falsehood now does not mean you have not planted in their mind a false statement that will lead to confusion later in their education. You can easily edit your answer to use solely true statements, with various degrees of detail you choose, such as “main is the entry point for your program, and only one main routine should be defined.”
    – Eric Postpischil
    Nov 11 at 20:24












  • @EricPostpischil That's not my answer.
    – Geier
    Nov 11 at 20:32










  • @EricPostpischil Welcome to your first day of driver's ed. Move the transmission control lever from P to D. This will remove the parking pawl and allow the fluid coupler to transmit power from the engine to the planetary gears inside the transmission delivering power from the engine to the crankshaft at various gear ratios. Then depress the accelerator pedal which will inform the fuel injection system to supply an increased fuel/air mixture to the cylinders of the engine supplying more power to the transmission, crankshaft, and wheels. Now merge onto the freeway.
    – Schwern
    Nov 11 at 20:52




















  • The operating system does not call main. The program loader initiates execution at the executable’s start address, which is typically at a symbol such as start. The code there initializes the C environment and then calls main.
    – Eric Postpischil
    Nov 11 at 19:51








  • 1




    @EricPostpischil I'm sure that difference is irrelevant for OP at his current level of understanding.
    – Geier
    Nov 11 at 20:07






  • 1




    @Geier: The fact they are unable to detect the falsehood now does not mean you have not planted in their mind a false statement that will lead to confusion later in their education. You can easily edit your answer to use solely true statements, with various degrees of detail you choose, such as “main is the entry point for your program, and only one main routine should be defined.”
    – Eric Postpischil
    Nov 11 at 20:24












  • @EricPostpischil That's not my answer.
    – Geier
    Nov 11 at 20:32










  • @EricPostpischil Welcome to your first day of driver's ed. Move the transmission control lever from P to D. This will remove the parking pawl and allow the fluid coupler to transmit power from the engine to the planetary gears inside the transmission delivering power from the engine to the crankshaft at various gear ratios. Then depress the accelerator pedal which will inform the fuel injection system to supply an increased fuel/air mixture to the cylinders of the engine supplying more power to the transmission, crankshaft, and wheels. Now merge onto the freeway.
    – Schwern
    Nov 11 at 20:52


















The operating system does not call main. The program loader initiates execution at the executable’s start address, which is typically at a symbol such as start. The code there initializes the C environment and then calls main.
– Eric Postpischil
Nov 11 at 19:51






The operating system does not call main. The program loader initiates execution at the executable’s start address, which is typically at a symbol such as start. The code there initializes the C environment and then calls main.
– Eric Postpischil
Nov 11 at 19:51






1




1




@EricPostpischil I'm sure that difference is irrelevant for OP at his current level of understanding.
– Geier
Nov 11 at 20:07




@EricPostpischil I'm sure that difference is irrelevant for OP at his current level of understanding.
– Geier
Nov 11 at 20:07




1




1




@Geier: The fact they are unable to detect the falsehood now does not mean you have not planted in their mind a false statement that will lead to confusion later in their education. You can easily edit your answer to use solely true statements, with various degrees of detail you choose, such as “main is the entry point for your program, and only one main routine should be defined.”
– Eric Postpischil
Nov 11 at 20:24






@Geier: The fact they are unable to detect the falsehood now does not mean you have not planted in their mind a false statement that will lead to confusion later in their education. You can easily edit your answer to use solely true statements, with various degrees of detail you choose, such as “main is the entry point for your program, and only one main routine should be defined.”
– Eric Postpischil
Nov 11 at 20:24














@EricPostpischil That's not my answer.
– Geier
Nov 11 at 20:32




@EricPostpischil That's not my answer.
– Geier
Nov 11 at 20:32












@EricPostpischil Welcome to your first day of driver's ed. Move the transmission control lever from P to D. This will remove the parking pawl and allow the fluid coupler to transmit power from the engine to the planetary gears inside the transmission delivering power from the engine to the crankshaft at various gear ratios. Then depress the accelerator pedal which will inform the fuel injection system to supply an increased fuel/air mixture to the cylinders of the engine supplying more power to the transmission, crankshaft, and wheels. Now merge onto the freeway.
– Schwern
Nov 11 at 20:52






@EricPostpischil Welcome to your first day of driver's ed. Move the transmission control lever from P to D. This will remove the parking pawl and allow the fluid coupler to transmit power from the engine to the planetary gears inside the transmission delivering power from the engine to the crankshaft at various gear ratios. Then depress the accelerator pedal which will inform the fuel injection system to supply an increased fuel/air mixture to the cylinders of the engine supplying more power to the transmission, crankshaft, and wheels. Now merge onto the freeway.
– Schwern
Nov 11 at 20:52




















draft saved

draft discarded




















































Thanks for contributing an answer to Stack Overflow!


  • Please be sure to answer the question. Provide details and share your research!

But avoid



  • Asking for help, clarification, or responding to other answers.

  • Making statements based on opinion; back them up with references or personal experience.


To learn more, see our tips on writing great answers.





Some of your past answers have not been well-received, and you're in danger of being blocked from answering.


Please pay close attention to the following guidance:


  • Please be sure to answer the question. Provide details and share your research!

But avoid



  • Asking for help, clarification, or responding to other answers.

  • Making statements based on opinion; back them up with references or personal experience.


To learn more, see our tips on writing great answers.




draft saved


draft discarded














StackExchange.ready(
function () {
StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2fstackoverflow.com%2fquestions%2f53252397%2fjust-wondering-what-is-exactly-wrong-with-my-code-c-programming%23new-answer', 'question_page');
}
);

Post as a guest















Required, but never shown





















































Required, but never shown














Required, but never shown












Required, but never shown







Required, but never shown

































Required, but never shown














Required, but never shown












Required, but never shown







Required, but never shown







Popular posts from this blog

Xamarin.iOS Cant Deploy on Iphone

Glorious Revolution

Dulmage-Mendelsohn matrix decomposition in Python