Hardware Reference
In-Depth Information
Figure 7.7 Output produced by the nested loop example program
increment operator is used to increment the count. Because s and t are defined
locally there is, in fact, no need to use different variables and the following code
would produce exactly the same result:
/* Name:
loop2.c
*/
/* Language:
Borland C++ 4.5
*/
/* Output:
Table of decimal, hex. and ASCII characters */
/* Note:
Program runs in a DOS console window
*/
#include <stdio.h>
int main()
{
int s;
s=0;
while (s < 4)
{
++s;
printf("Outer loop count = %d\n", s);
inner();
}
return 0;
}
int inner()
{
int s;
s=0;
while (s < 4)
{
++s;
printf("\tInner loop count = %d\n", s);
}
}
Inputs and prompts
A single character can be returned from the standard input (usually the keyboard)
by means of the getchar() function. The following routine shows how a single
Search WWH ::




Custom Search