#include <stdio.h>
#include <stdlib.h>
void message(char m)
{
print("Hello\n");
}
int main()
{
message(m);
}
Error message when I try to compile
danielc@Ubuntu11:$ gcc Messagef.c -o Messagef
Messagef.c: In function ‘main’:
Messagef.c:11:9: error: ‘m’ undeclared (first use in this function)
Messagef.c:11:9: note: each undeclared identifier is reported only once for each function it appears in
I know that am doing a ‘silly’ mistake but I just see where am going wrong
Your function takes a
charparameter but never uses it. The simplest fix is to remove the unused parameter:Alternatively, change your method to use the parameter, and pass in a character as an argument:
See it working online: ideone