Thread: Re where and wherey

  1. #1
    zach
    Guest

    Re where and wherey

    Code:
    #include<stdio.h>
    #include<string.h>
    #include<conio.h>
    #include<windows.h>
    void locate (int x, int y) ;
    
    
    
    int main(void)
    {
    int response = 0;
    locate(5,5);puts("Your input: "); 
    
        while((_wherex != 20) && (_wherey != 5)) 
        //Operands of '!=' have incompatible types 'int __cdecl (*)(void)' and 'int'.
        {
            locate(20,5);
            scanf("%d",&response);
        }
    return 0;
    }
    
    void locate(int x, int y) 
        {
            COORD pos = {x, y};
            SetConsoleCursorPosition(GetStdHandle(STD_OUTPUT_HANDLE), pos);
        }
    re // I don't understand the errors.

  2. #2
    null pointer Structure's Avatar
    Join Date
    May 2019
    Posts
    338
    '_wherex' undeclared
    '_wherey' undeclared
    where are these variables ?
    "without goto we would be wtf'd"

  3. #3
    zach
    Guest
    Quote Originally Posted by Structure View Post
    where are these variables ?
    _wherex and _wherey are themselves not the problem and are not an essential part of my question. They are non-standard statements, made available by the IDE (Pelles C) and were tested to work okay.

  4. #4
    null pointer Structure's Avatar
    Join Date
    May 2019
    Posts
    338
    //Operands of '!=' have incompatible types 'int __cdecl (*)(void)' and 'int'.
    When evaluating variables they should be of the same type.
    i.e:

    (float)1.0 != (int)1 is invalid.
    "without goto we would be wtf'd"

  5. #5
    and the hat of int overfl Salem's Avatar
    Join Date
    Aug 2001
    Location
    The edge of the known universe
    Posts
    39,660
    > while((_wherex != 20) && (_wherey != 5))
    The error message suggests it should be
    while((_wherex() != 20) && (_wherey() != 5))
    If you dance barefoot on the broken glass of undefined behaviour, you've got to expect the occasional cut.
    If at first you don't succeed, try writing your phone number on the exam paper.

  6. #6
    zach
    Guest
    Quote Originally Posted by Salem View Post
    > while((_wherex != 20) && (_wherey != 5))
    The error message suggests it should be
    while((_wherex() != 20) && (_wherey() != 5))
    Yes - works fine! Thank you.

Popular pages Recent additions subscribe to a feed

Similar Threads

  1. Replies: 1
    Last Post: 09-12-2002, 05:49 AM

Tags for this Thread