Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 986783
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 16, 20262026-05-16T05:22:29+00:00 2026-05-16T05:22:29+00:00

I have this code: void PrintMainParameters(int n, char* array[]) { int i = 0;

  • 0

I have this code:

void PrintMainParameters(int n, char* array[])
{
  int i = 0;
  for(i = 0; i < n; i++)
  {
   printf("%s \n", array[i]);
  }
}

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

Works fine. Now I want to write PrintMainParameters as prototype to declare the function later in the source file.

I tried this one, but it says type mismatch, that the second parameter is an incompatible pointer type. I understand the compiler error, but I do not know why it occurs.

void PrintMainParameters(int, char*);


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

void PrintMainParameters(int n, char* array[])
{
  int i = 0;
  for(i = 0; i < n; i++)
  {
   printf("%s \n", array[i]);
  }
}

How must the prototype look like? Why does my code not work?

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-05-16T05:22:30+00:00Added an answer on May 16, 2026 at 5:22 am

    You can use either:

    void PrintMainParameters(int, char**);
    

    or:

    void PrintMainParameters(int, char *[]);
    

    Or if you prefer, you can insert a dummy parameter into the prototype, such as:

    void PrintMainParameters(int argc, char *argv[]);
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I have this code: void changeToCapital(char* str) { int i; for (i=0; i<strlen(str); i++)
If I have this code: void Foo(aBasicType aIn) //Where aBasicType is int, char etc.
I have this code: void fill_array (unsigned int *iarray, char *string, int max) {
I have this code: public void replay() { long previous = DateTime.Now.Ticks; for (int
have this code: void set(list<Person*>* listP){ Person timmy = Person(10); listP->push_back(&timmy); } int main()
I have this code : void Main() { System.Timers.Timer t = new System.Timers.Timer (1000);
I have this code: //choosed a picture public void onActivityResult(int requestCode, int resultCode, Intent
I have this code: hubSpinner.setOnItemSelectedListener(new OnItemSelectedListener() { public void onItemSelected(AdapterView<?> parentView, View selectedItemView, int
I have this code: void getStringWithTag(char* pFile, long sizeSound, char* tag, char* ret, float*
I have this code: public void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); setContentView(R.layout.main); ListView lv =

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.