Shop OBEX P1 Docs P2 Docs Learn Events
Simple IDE Output Question — Parallax Forums

Simple IDE Output Question

John AbshierJohn Abshier Posts: 1,116
edited 2013-04-20 09:24 in Propeller 1
Code run
/*
  Variables and Calculations.c
  
  Add two integer values together and display the result.
  
  http://learn.parallax.com/propeller-c-start-simple/variables-and-math
*/

#include "simpletools.h"                      // Include simpletools

int main()                                    // main function
{
  pause(1000);                                // Wait 1 s for host computer
  int a = 25;                                 // Initialize a variable to 25
  int b = 17;                                 // Initialize b variable to 17
  int c = a + b;                              // Initialize c variable to a + b
  printf("a = %d, b = %d\n", a,b);
  printf("c = %d\n ", c);                     // Display decimal value of c
  c = a - b;
  printf("a = %d, b = %d\n", a,b);
  printf("c = %d\n ", c);                     // Display decimal value of c
}

Why is third line of output indented one space?
a = 25, b = 17
c = 42
 a = 25, b = 17
c = 8

Simple IDE version 0.9.21
John Abshier

Comments

  • Heater.Heater. Posts: 21,230
    edited 2013-04-20 08:29
    Because of this line:

    printf("c = %d\n ", c);

    Can you spot the extra space after the \n ?
  • John AbshierJohn Abshier Posts: 1,116
    edited 2013-04-20 09:04
    Now I can. I need to get glasses (perhaps Google Glass) with vertical lines that adjust to character width on the screen.

    Thanks

    John Abshier
  • frank freedmanfrank freedman Posts: 1,983
    edited 2013-04-20 09:24
    Even better, perhaps you can get the Google glass with developers plugins such as lint and line numbering as well. Wonder if they could do color overlays for syntax highlighting...
    Now I can. I need to get glasses (perhaps Google Glass) with vertical lines that adjust to character width on the screen.

    Thanks

    John Abshier
Sign In or Register to comment.