|
CS256 - Principles of Structured Design
Fall 2021
|
Displaying ./code/cs256su21code/may25/var.c
#include <stdio.h>
int main(){
int x; //declaring an integer variable named "x"
x = 4; //setting x equal to 4, this is an assignment operator
int y = x/2;
/*
above, we're setting the integer variable "y" equal to x/2. since we have
a value for "x" x/2 will be evaulated and then assigned to y. here, y will equal 2.
*/
printf("There are %d bananas\nand %d apples\n",x, y); //we use %d to print integers on the screen
return 0;
/*
if we have more than 1 integer, the first %d corresponds to the first argument, the x, and
the second %d cooresponds to the second argument, the y
*/
}
|