Skip to main content
Arduino

Return to Answer

replaced http://stackoverflow.com/ with https://stackoverflow.com/
Source Link

Assume you want the clock to start at 08:42:21, change

int seconds, minutes, hours;

to

int seconds = 21, minutes = 42, hours = 8;

Note that you should always also initialize (as in the second case above), and not only declare (as in the first case) all variables before you first read their values. Otherwise, for local variables you cannot be sure cannot be sure what their initial value is. (Global variables are implicitly initialized implicitly initialized to zero if not explicitly initialized.)

Assume you want the clock to start at 08:42:21, change

int seconds, minutes, hours;

to

int seconds = 21, minutes = 42, hours = 8;

Note that you should always also initialize (as in the second case above), and not only declare (as in the first case) all variables before you first read their values. Otherwise, for local variables you cannot be sure what their initial value is. (Global variables are implicitly initialized to zero if not explicitly initialized.)

Assume you want the clock to start at 08:42:21, change

int seconds, minutes, hours;

to

int seconds = 21, minutes = 42, hours = 8;

Note that you should always also initialize (as in the second case above), and not only declare (as in the first case) all variables before you first read their values. Otherwise, for local variables you cannot be sure what their initial value is. (Global variables are implicitly initialized to zero if not explicitly initialized.)

editing in comment
Source Link
fuenfundachtzig
  • 1.5k
  • 1
  • 14
  • 26

Assume you want the clock to start at 08:42:21, change

int seconds, minutes, hours;

to

int seconds = 21, minutes = 42, hours = 8;

Note that you should always also initialize (as in the second case above), and not only declare (as in the first case) all variables before you first read their values. Otherwise, otherwisefor local variables you cannot be sure what their initial value is. (Global variables are implicitly initialized to zero if not explicitly initialized.)

Assume you want the clock to start at 08:42:21, change

int seconds, minutes, hours;

to

int seconds = 21, minutes = 42, hours = 8;

Note that you should always also initialize (as in the second case above), and not only declare (as in the first case) all variables before you first read their values, otherwise you cannot be sure what their initial value is.

Assume you want the clock to start at 08:42:21, change

int seconds, minutes, hours;

to

int seconds = 21, minutes = 42, hours = 8;

Note that you should always also initialize (as in the second case above), and not only declare (as in the first case) all variables before you first read their values. Otherwise, for local variables you cannot be sure what their initial value is. (Global variables are implicitly initialized to zero if not explicitly initialized.)

Source Link
fuenfundachtzig
  • 1.5k
  • 1
  • 14
  • 26

Assume you want the clock to start at 08:42:21, change

int seconds, minutes, hours;

to

int seconds = 21, minutes = 42, hours = 8;

Note that you should always also initialize (as in the second case above), and not only declare (as in the first case) all variables before you first read their values, otherwise you cannot be sure what their initial value is.

lang-cpp

AltStyle によって変換されたページ (->オリジナル) /