-1

I'm attempting to prompt the user to input the amount of time they want the program to wait. However, when I compile the program, it produces the forllowing warning:

warning: assignment makes integer from pointer without a cast

The warnings references the following line:

y = sleeptime;

I don't quite understand this as there aren't any pointers in my program.

Thanks in advance.

#include <stdio.h>
#include <stdlib.h>
#include <time.h>
#include <unistd.h>

int sleeptime(void)
{
    int x;
    x = 0;
    printf("How long would you like to wait?\n");
    scanf("%d", &x);

    return x;
}

int main(void)
{
    int y;    
    y = 0;
    y = sleeptime;
    sleep(y);

    return 0;
}
ikegami
  • 367,544
  • 15
  • 269
  • 518
L.Kay
  • 61
  • 4
  • 3
    How do you *call* functions in C? Perhaps you need a couple of [good beginners books](http://stackoverflow.com/questions/562303/the-definitive-c-book-guide-and-list) to read? – Some programmer dude Oct 31 '17 at 04:49
  • ah i just realised the mistake. Yes i definitely could build my foundations better. Thanks! – L.Kay Oct 31 '17 at 04:55

1 Answers1

1

Just Change

y = sleeptime;

to

y = sleeptime();
Varun
  • 447
  • 4
  • 9