Q:

Is there some way to have y = k*m but in integers only?

I'm trying to write out pixles on a LCD. I'm plotting them at X, Y coordinates and I'm using this code:
void SSD1306_draw_line(uint8_t x0, uint8_t x1, uint8_t y0, uint8_t y1){
    uint8_t k = (x1 - x0)/(y1 - y0);
    uint8_t y = y0;
    for(uint8_t x = x0; x < x1; x++){
        pixel(x, y, true);
        y += k;
    }
}

The problem where is that if k becomes a decimal number e.g 1.98, then k will still 1. If k = 2.01, then k = 2 due to the uint8_t datatype.
Assume that we are going to plot the line (0,0), (40, 20) {x,y}. 
Sure, now k will be 2. That works!
But assume that if we plot the line (0,0), (35, 20) {x,y}. 
Now k will be a float number of 1.75. This will not work for me. 
Is there a way to find a better k?
I have tried this, but the line does not follow the coordinates.
void SSD1306_draw_line(uint8_t x0, uint8_t x1, uint8_t y0, uint8_t y1){
    float k = 0;
    if(y1 > x1){
        k = (y1 - y0)/(x1 - x0);
    }else{
        k = (x1 - x0)/(y1 - y0);
    }
    float y = y0;
    for(uint8_t x = x0; x < x1; x++){
        pixel(x, (uint8_t) y, true);
        y += k;
    }
}

A:

Instead of attempting FP math, research Bresenham's line algorithm for an all integer solution.
Untested code:
void SSD1306_draw_line(uint8_t x0, uint8_t x1, uint8_t y0, uint8_t y1) {
  int dx = x1 - x0;
  int dy = y1 - y0;
  int D = 2*dy - dx;
  int y = y0;

  // code still needs work when x0 > x1 or |dy| > |dx|
  for (int x = x0; x <= x1; x++) {
    pixel(x,y,true);
    if (D > 0) {
      y++;
      D = D - 2*dx;
    }
    D = D + 2*dy;
  }
}

