0

im just trying to use the inputted terms in the main function. the error is:

hwk6.c:10: error: expected ';', ',' or ')' before '*' token

#include <stdio.h>
#include <math.h>
int getTerms(void);
int term1;
int term2;
int term3;
int term4;
int term5;

int main(int term1*, int term2*, int term3*, int term4*, int term5*)
{
  getTerms();

printf("they are: %d %d %d %d %d", term1, term2, term3, term4, term5);
 return 0;
}


int getTerms(void)
{
  int term1;
  int term2;
  int term3;
  int term4;
  int term5;

  printf("The first 5 numbers of the series now: ");
  scanf("%d %d %d %d %d", &term1, &term2, &term3, &term4, &term5);

  return 0;
3
Contributors
6
Replies
7
Views
8 Years
Discussion Span
Last Post by Ancient Dragon
0

int main() is declared wrong. There are only two acceptable ways to declare it

int main()
{
}

int main(int argc, char* argv[])
{
}

>>int term1*
You don't declare a pointer like that -- you have the asterisk in the wrong place: int* term;

0

hey dudes there are three ways to declare main function
1>int main () {}
2>int main (int argc, char *argv[]) {}
3>int main (int argc, char *argv[], char *arge[]) {}


***arge argument is used for environment variables......

0

hey dudes there are three ways to declare main function
1>int main () {}
2>int main (int argc, char *argv[]) {}
3>int main (int argc, char *argv[], char *arge[]) {}


***arge argument is used for environment variables......

Sorry but the third argument is non-standard by some compilers. MAC even has a fourth argument. Here is a good article about this.

0

hey Ancient Dragon, thanx for ur new information can you plz tel watz that fourth argument used in main funtion in Mac environment...........
thanx in advance

0

hey Ancient Drago, thanx for ur useful information..................

0

hey Ancient Dragon, thanx for ur new information can you plz tel watz that fourth argument used in main funtion in Mac environment...........
thanx in advance

read the link I posted. Other than that I don't know because I've never coded for MAC

This topic has been dead for over six months. Start a new discussion instead.
Have something to contribute to this discussion? Please be thoughtful, detailed and courteous, and be sure to adhere to our posting rules.