0

I have this code:

#include <stdio.h>

int main() {

    
dosome();

}


char* dosome() {
    char* buffer = malloc(sizeof(char) * 128);    
    
    gets(buffer);

    puts(buffer);

    return buffer;
}

I want to return the buffer, so it can be printed, or worked with in the main function in some way. This gives a reutrn type error though I'm aware that gets() is not safe. This is a proof of concept

The error looks as follows simple.c:11:7: error: conflicting types for ‘dosome’ 11 | char* dosome() { | ^~~~~~

Grazosi
  • 603
  • 1
  • 10

1 Answers1

-3

You didn't declare the function

Add char * dosome(); Somewhere near the main function

Primitive
  • 91
  • 1
  • 6