• + 0 comments

    I submitted the solution of this problem successfully on HackerRank but vjudge is throwing these warning and errors, can someone help me out to solve them?

    Solution.c: In function ‘main’:
    Solution.c:12:5: error: ‘main’ is normally a non-static function [-Werror=main]
     int main() {
         ^~~~
    Solution.c:9:10: warning: unused variable ‘s’ [-Wunused-variable]
         char s[] = "HackerRank ";
              ^
    Solution.c:8:12: warning: unused variable ‘d’ [-Wunused-variable]
         double d = 4.0;
                ^
    Solution.c:7:9: warning: unused variable ‘i’ [-Wunused-variable]
         int i = 4;
             ^
    At top level:
    Solution.c:12:5: warning: ‘main’ defined but not used [-Wunused-function]
     int main() {
         ^~~~
    cc1: some warnings being treated as errors
    

    #Here is the solution_code:

    #include <stdio.h>
    
    
    int main() {
        int i = 4;
        double d = 4.0;
        char s[] = "HackerRank ";
        int i2;
        double d2;
        char s2[100];
        
        scanf("%d", &i2);
        scanf("%lf", &d2);
        scanf(" %[^\n]", s2);
        
        printf("%d\n", i + i2);
        printf("%0.1lf\n", d + d2);
        printf("%s%s", s, s2);
    
        return 0;
    }