C on Sandbox

Here is what I learnt today:

{
int i = get_int("Integer: ");
printf("Hello, %i\n", i);
}

I want an integer, so I set the variable to “int”. Then I set it’s name to “i”. You need to set the function of the variable. I do this by using “get_int”.

Then, to display on the screen I use “printf. What it prints is “Hello” then I use “%i\n”, which I need in order to use the variable “i”.

Also, when you make changes to the code you need to use “make (program name)” as in “make int” then to run the code use ./(program name) as in ./int

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out /  Change )

Google photo

You are commenting using your Google account. Log Out /  Change )

Twitter picture

You are commenting using your Twitter account. Log Out /  Change )

Facebook photo

You are commenting using your Facebook account. Log Out /  Change )

Connecting to %s