Reference to main without defining

0

When trying to compile the following code by command line, it returns the following error:

  

"/ usr / lib / gcc / x86_64-linux-gnu / 5 /../../../ x86_64-linux-gnu / crt1.o: In the function _start ': (.text + 0x20) : reference to main 'undefined   collect2: error: ld returned 1 exit status "

#include <stdio.h>
#include <stdlib.h>
#include <time.h>
#define TAM 10

main()
{
char arreglo[TAM];
char *apc;
apc=arreglo;
srand=(time(NULL));

for(int i=0;i<TAM;i++)
{
    *apc=(rand%(11));
    *apc++;
}

printf("El arreglo es:\n");
for(int i=0;i<TAM;i++)
    printf("%d = %d",(i+1),arreglo[i]);

return 0;
}
    
asked by Ricardo Alcaraz 21.10.2017 в 20:36
source

1 answer

-1

You need to add int in front of main.

int main(){
    .
    .
    .
    return 0;
}
    
answered by 16.02.2018 в 19:57