C Programming Tutorial - 7 - Variables

preview_player
Показать описание
Рекомендации по теме
Комментарии
Автор

To conserve space. Instead of typing:
int age;
int currentYear;
int birthYear;

I just type:

int age, currentYear, birthYear;

I've learnt so much after just 1hr+, man! You're absolutely brilliant!

idamooooo
Автор

Tutorial 6:
%f stands for float
%s stands for string
%d stands for double
Source:cheat engine.

nukami
Автор

You can declare variables and give them values in the same line too:

int currentYear=2015;
int birthYear=1992;
int age=currentYear-birthYear;

fu
Автор

Through this video, I learnt how to make a basic calculator. Here is the code:
#include <stdio.h>

int main()
{
int num1;
int num2;
int sum;
int subtract;
int multiply;
int division;
printf("Enter the num1");
scanf("%d", &num1 );
printf("Enter the num2");
scanf("%d", &num2);
sum = num1 + num2;
printf("the sum of these numbers is %d \n", sum);
subtract = num1 - num2;
printf("the difference of these numbers is %d \n", subtract);
multiply = num1 * num2;
printf("the product of these numbers is %d \n", multiply);
division = num1 / num2;
printf("the division of these numbers is %d \n", division);
return 0;
}

kayleexxo
Автор

thank god we have you, was completely lost in my C class until I started watching these

AC
Автор

A variables is a way for you to store values into computer memory. When you create a variable, you are actually telling the computer you wish to use some of it's memory to store some numbers in (even characters, as each character has a numerical value that gets stored). But, you need to tell the computer how much memory you wish to use, so you set the type, like "int", tells the computer you wish to store an integer, not a floating point (it has no fractional values). All ints on 32bit computers are four bytes, so the computer sets aside four bytes of memory to store your number in. You then give that int a label for you to access it. You could literally access the numerical memory address it uses, but that would be harder to remember than an actual word as a label. You then tell it what value you wish to store into that memory location. When you use it later on, the computer will basically look for where that label is in memory, look at that location in RAM, pull the value out and display it on screen (or if it's a character, it pulls the number, then looks up on a table what the letter is that number represents then displays that character). You can actually display the numerical value of a character if you wish. It is IMPORTANT to understand that ALL variables are stored in memory and that the variable name references a memory address where your value is stored. This will become important later on when you learn about something called pointers, which basically point to an address in memory.

NeilRoy
Автор

I love the way he even teaches this very basic stuff.
Love you man.

aprender
Автор

I love how he makes every coding sounds so easy

azmirakhalid
Автор

I have to say thank you Bucky\n I wish I'd started your tutorials before Uni. You have changed the way I learn.

TheUglyvideo
Автор

If you wanna learn guys u need to follow these steps by steps but try to do some exercise otherwise u won't get it. I love the way u are taking the time because I see some videos where they go really fast. Sometimes I forget semicolons but inmediately I got an error under and I correct it. Really nice program.

bestbuildpc
Автор

Hey man thanks for the vids. Im in programming classes and the book reads like stereo instructions. And every video you have covers all the chapters in the book so thanks for the great vids. You break everything down and make it so much more understandable. Thx again

jaysonmckeownsr
Автор

How can someone dislike this
Such amazing tutorials. Love this so much. I have learnt so much in a few days.
You sir are an incredible citizen.
God bless your soul.

mwawd
Автор

Bucky your the man bro. I cannot tell how much I appreciate your tutorials . I would have paid my last and kept my priceless learning treasure far away from the unappreciatives. Thanks again my brother.

MrVayga
Автор

Love this guy's humor in his teaching. Very entertaining to learn

volo
Автор

Man I love your tutorials, but it seems to me your always hungry? Which in turn makes me hungry.

greaterthanbut
Автор

Dude, I must say your stuff is amazing!

shans
Автор

Really good video's dude. Much appreciated. I'm taking an algorithm and design class and we are using C to write our first program. Scary stuff but this really helps!

SmackTV
Автор

Age calculator where the user gets to input his current year and birthyear, #include <stdio.h>
#include <stdlib.h>int main()
{
 int age;
 int currentYear;
 int birthYear; printf("Enter your birthyear");
 scanf("%d", &birthYear);
 printf("Enter your currentyear");
 scanf("%d", &currentYear);
 age = currentYear - birthYear;
 printf("you are %d years old", age);
 return 0;
}

ayushjha
Автор

In C# you can declare an integer and assign value to it on one line.
Example,
int x = 10;
I discovered that C allows you to do the same.

Atristiel
Автор

I have now become great in programming thanks for helping me out.

muhammadrafay