Skip to content
UoL CS Notes

Sheet 2

COMP124 Labs

Using Local Variables

Variables will be declared in the C portion of the code and take up the following amount of space:

  • int - 4 bytes
  • char - 1 byte
    • Strings will take as many bytes and characters.

Example of Common Assignments

int num = 0;
signed in num = -2;
char alpha = 'a';
char name[] = "Jo Smith\n";

In this example the string must end with \n in order to print the next statement on the next line.

\n has the decimal value of 10.