0

I think I did exactly like he showed. But there comes an error message.

When running it through help50 make meow it says:

You seem to be passing in too many arguments to a function on line 8 of meow.c. The function meow is supposed to take 0 argument(s), but you're passing it 1. Try providing 1 fewer argument(s) to the function.

This is my code, please help me to see what I´ve done wrong.

#include <stdio.h>

//Prototype
void meow(void);

int main(void)
{ 
    meow(3);
}

void meow(int n)
{
    for(int i = 0; i < n; i++)
    {
        printf("meow\n");
    }
}
5
  • Also, this is my first time posting here. How do I format the code? Mar 8 at 11:22
  • Welcome! Three backticks\backquotes\grave accents (`) in a row, followed by the the language (so just typing c for this question) will start a code block with syntax hightlights. If you want to end the code block to type more text, you can close it with three more backticks\backquotes\grave accents, but that is not necessary in situations like this where the code block is the end of the post. Mar 8 at 12:10
  • Thank you so much!! Mar 8 at 12:37
  • No problem. Don't forget to accept Cliff's answer by clicking the checkmark next to it, if it solved your issue. :) Mar 8 at 15:00
  • cs50.stackexchange.com/questions/41118/… This is kinda the same problem.this guy edited it.
    – user32155
    Apr 13 at 18:16
2

The prototype and the actual function don't match.

//Prototype
void meow(void);
...

void meow(int n)
{...

I'm surprised it even compiled. Both need to have int n

1
  • Thank you so much!!! He didn´t show that on the lecture. Thanks a lot!! Mar 8 at 11:56

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .