1

I'm learning the programming language C and using the Betty coding style of writing C github.com/holbertonschool/betty),

I have have been getting this syntax warning.

#include <stdio.h>
int main(void)
{
    int a;
    printf("\n Enter: ");
    scanf("%d", &a);
    return (0);
}
total: 0 errors, 1 warnings, 8 lines checked
c:2: warning: no description found for function main
bad_coder
  • 11,289
  • 20
  • 44
  • 72
Noémie
  • 21
  • 1
  • 1
  • 2
  • 1
    Welcome to SO. I've never seen such an error message. Normally functions are not "described" but defined. What compiler are you using? How do you call that compiler and/or the linker? – Gerhardh Jun 05 '22 at 08:37
  • 1
    Why is this tagged "macbookpro-touch-bar"? – Fra93 Jun 05 '22 at 08:52
  • MSVC gives a similar warning if you omit the `void` argument list. I.e. `int main() {...` gives *warning C4255: 'main': no function prototype given: converting '()' to '(void)'*. But that's not the case in your code. – Adrian Mole Jun 05 '22 at 09:38
  • Which compiler are you using an dhow are you compiling your program? – knittl Jun 05 '22 at 11:13
  • 3
    Using a search engine the the error message leads to https://github.com/holbertonschool/Betty/blob/master/betty-doc.pl – which seems to be custom style checker for C programs. It requires your C programs to be formatted and commented in a certain way. Not really a C question. In that case, your teacher/trainer can best give you answers how the code is expected to look. – knittl Jun 05 '22 at 11:18

1 Answers1

8

After including the library, you ought to include a description of the program, like so:

#include <stdio.h>

/**
 * main - Entry point
 * 
 * Description: 'the program's description'
 * @parameter: describe the parameter
 * 
 * Return: Always 0 (Success)
 */

int main(void)
{
    Code goes here
}
David Bakare
  • 496
  • 3
  • 6