Easy Tutorial
❮ C Bit Fields C Function Fabs ❯

C Exercise Example 45

C Language Classic 100 Examples

Title: Learn how to use the register keyword to define variables.

Program Analysis: None.

Program Source Code:

//  Created by www.tutorialpro.org on 15/11/9.
//  Copyright © 2015 tutorialpro.org. All rights reserved.
//

#include <stdio.h>
int main()
{
    register int i;
    int tmp = 0;
    for (i = 1; i <= 100; i++)
        tmp += i;
    printf("The total sum is %d\n", tmp);
    return 0;
}

The output of the above example is:

The total sum is 5050

C Language Classic 100 Examples

❮ C Bit Fields C Function Fabs ❯