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;

Recommended Answers

All 6 Replies

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;

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......

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.

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

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

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

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.