0

I've started the course of computer science this year and even then I have never studied anything about programming, so maybe this is why i am having so many basic mistakes like this.

My problem right now is with the library in C that I have to use to do my final work in the course, which is a game.

My professor passed some activities for us to learn how to use the conio, but for now the only thing that I could do was to install it. The first activitie is "2) Create a void function that print a letter read from the keyboard in the position (x, y) using the Conio functions.". Searching in the functions, I founded that the function "putchxy" does exactly this, but when I try to compile the program with it, I think that it isn't doing absolutly nothing, because it should print the readen charecter and it does nothing. I used abritary values defined inside the program for x and y.

#include <stdio.h>
#include <conio2.h>
#include <conio.h>

int main () 
{ 
char ch; 
int x = 5, y = 5;

printf("Type a letter in the keyboard:\n");
scanf(" %c", &ch);
void putchxy (int x, int y, char ch);

return (0);
}

As this was the last class, I am with a lot of questions if I am doing this right. But looking in the presentation of the class, reading about the function inside the library itself, searching similar cases here in stack overflow, i couldn't find nothing that indicates me my mistake.

I already tried other ways, like create myself a function, tried to invert, to put numbers, but any form like those worked propely.

Where's my mistake?

I know that it is an outdated library, but it's obligated in this project to use it. It's the firs semester, I think that it makes sense. I don't need any objection to its use, thank you.

Sorry for any English mistake, it is my second language.

  • It doesn't do anything because you didn't actually call it... – user253751 Apr 29 '18 at 23:39
  • And how i do that? I already tried, but i must have did something wrong and I didn't finded how to in anywhere else – LucasCardoso910 Apr 29 '18 at 23:52
  • Did you try `putchxy(x, y, ch);`? – user253751 Apr 29 '18 at 23:59
  • It gives a warning: "undefined reference to 'putchxy'" – LucasCardoso910 Apr 30 '18 at 00:05
  • "undefined reference" means that you didn't tell the compiler to look for functions in the library. How to do that for your compiler must be part of the instructions for using conio in the exercises. – Bo Persson Apr 30 '18 at 00:29
  • Oh I founded the error source. When I was installing the library, I should put the adress of the library in the folder of Code::blocks in the linker, I did it, but now I looked it again and it had vanished. I put it again and it worked. Thank you very much for everyone who helped me – LucasCardoso910 Apr 30 '18 at 01:14

1 Answers1

0

regarding:

void putchxy (int x, int y, char ch);

this is the prototype for the function.

TO actually call the function use:

putchxy( x, y, ch );
user3629249
  • 16,402
  • 1
  • 16
  • 17
  • Yes, it's working now. (well, I'm having another problem, but I will try all ways that I can think of hehe) My problem was really the bad configuration of the library, but thanks very much. I accepted your answer for everyone who has the same question as I to know how to do it. Thank you very much – LucasCardoso910 Apr 30 '18 at 03:55