Print function, hello world in C

Viewed 277

Started reading C a few days back, i'm trying to learn how to split my code into functions, can anyone tell me why it's not printing "hello world" for me?


#include <stdio.h>


void PRINT(){

    printf("hello world");
}



int main() {    

   void PRINT();
   
}

3 Answers

You should call the function like this:

int main() {    
  PRINT();
}

Try this:

int main()
{
   printf("Hello World");
   return 0;
}

or try this:

void PRINT(){

    printf("Hello World");
}

int main() {    

   PRINT();
   
}

Make sure to #include <stdio.h> at the top.

if you want to call a function, you should not put data types before your function's name. try this :

int main()
{
   
    PRINT();
    return 0;

}
Related