You are on page 1of 2

Include string data type in slide 11 and 13..

Variable usage:
Fundamental Data types:
1. character (char)- uses only a single character ('a', 'A', '*')
2. integers (int) - whole numbers such as (1, 102139232)
3. Floats (float) - numbers that accept precise value or numbers with decimal po
ints(3.1416)
4. String (string) - accepts string of characters or words("Hello World", "Von A
lano")

Declaration of Variable:
1. one variable without initialization
int x;
float y;
string a;
2. multiple variables without initialization
int a;
int b;
int c;
or
int a, b, c;
3. one variable with initialization
int a=0;
float b=3.14;
sting x="Hello World";
4. multiple variables with initialization
int a=0;
int b=1;
int c=3;
or
int a=0, b=1, c=3;

Rules in naming identifiers:


1. Do not use reserved words (i.e. char, int, double)
2. Do not assign a value to a variable in which its data types do not match or e
lse the program will automatically terminate or the program will not work proper
ly.
3. In naming variables, do not use spaces if you want a two-word variable name.
4. The name should start with a letter
5. No special character except for underscore "_"

You might also like