hello2.c

  #include <stdio.h>

  int main()
  {
     int age;

     age = 23;
     printf("Hello world!\n");
     printf("My age is %d.\n", age);
     return 0;
  }
  • Here's how to declare a variable. In this example, we declare a variable called age with a type of int.
  • A variable of type int can only store integer values.
  • Other types available in C/C++ are:
    • float -- To store fractional numbers.
    • char -- To store letters (or, to be exact, characters).
    • long -- To store integer values, but it has bigger capacity than int.

 


Where to go

Chapter 2
News Page
Lesson 1 contents
Contacting Me


Roby Joehanes © 2001

Hosted by www.Geocities.ws

1