Thread: compiler warning message

  1. #1
    Registered User alice's Avatar
    Join Date
    Mar 2004

    compiler warning message


    When I compile the program, the compiler return a warning message: "Call to function 'printStatistics' with no prototype"
    Can someone told me how can I correct it? thk a lot

    #include <stdio.h>
    #include <stdlib.h>
    #include <time.h>
    #define TESTSET 1000000
    int counter[3]; /* to hold the occurence of 0, 1, and 2 */
    void printStatistics() {
      int i;
      printf("Value       Frequency\n");
      for (i=0; i<3; i++) {
        printf("%d            %d\n", i, counter[i]);
    void generateStatistics(int number) {
      int i;
      int random;
      srand(time(NULL));  /* set a new random seed */
      for (i=0; i<number; i++) {
        random = rand() % 3; /* generate 0, 1, or 2 */
    void main() {
      printf("Frequencies of 0, 1, and 2 in %d values\n", TESTSET);

  2. #2
    and the hat of int overfl Salem's Avatar
    Join Date
    Aug 2001
    The edge of the known universe
    > void printStatistics() {
    This isn't a prototype, it's an old style function definition
    void printStatistics( void ) {

    It would be OK in C++ though, because foo() and foo(void) are the same thing, but that's not the case in C

    void main as noted in my other reply
    If you dance barefoot on the broken glass of undefined behaviour, you've got to expect the occasional cut.
    If at first you don't succeed, try writing your phone number on the exam paper.

  3. #3
    Join Date
    Apr 2004
    si vous utilisez (turbo c) sous ms-dos veuiellez ecrire le mot void dans les parenthese
    sinon ilfaut voir si vous avez oubliez un sous programme sous c++ qui est deja en marche et qui utilise un void main()

Popular pages Recent additions subscribe to a feed

Similar Threads

  1. added start menu crashes game
    By avgprogamerjoe in forum Game Programming
    Replies: 6
    Last Post: 08-29-2007, 01:30 PM
  2. Making a script language?
    By Blackroot in forum Game Programming
    Replies: 10
    Last Post: 02-16-2006, 02:22 AM
  3. <Gulp>
    By kryptkat in forum Windows Programming
    Replies: 7
    Last Post: 01-14-2006, 01:03 PM
  4. DLL compiling question
    By Noose in forum Windows Programming
    Replies: 2
    Last Post: 12-16-2004, 07:16 AM
  5. Compiler warning question
    By Thantos in forum C Programming
    Replies: 6
    Last Post: 12-05-2003, 05:39 AM