CabConModding
Facebook
Twitter
youtube
Discord
Contact us
RSS
Menu
CabConModding
Home
New
Top
Premium
Rules
FAQ - Frequently Asked Questions
Games
Fornite
Call of Duty: Black Ops 3
Clash of Clans
Grand Theft Auto 5
Apex Legends
Assassin’s Creed Origins
Forums
Premium
Latest posts
What's new
Latest posts
New profile posts
Latest activity
Members
Current visitors
New profile posts
Log in
Register
What's new
Premium
Latest posts
Menu
Log in
Register
Navigation
Install the app
Install
More options
Dark Theme
Contact us
Close Menu
Forums
Tech Boards
Computer Programming
Source Code & Tutorial
Zone's C Programming Tutorials #2 Variables
JavaScript is disabled. For a better experience, please enable JavaScript in your browser before proceeding.
You are using an out of date browser. It may not display this or other websites correctly.
You should upgrade or use an
alternative browser
.
Reply to thread
Message
<blockquote data-quote="ZoneAye" data-source="post: 14538" data-attributes="member: 18741"><p>Hi guys Zone here again this is my second part of my C Programming Tutorials in this tutorial we will be looking at variables you should know what they are used for if you have done programming before but incase you don't they are used to store stuff so like someones name,age,initial etc really anything. So lets jump right into the tutorial. </p><p></p><p>We will be looking at the variables below </p><p>string </p><p>char </p><p>int or integer </p><p>float </p><p>void </p><p></p><p>string is used to store text so you could store someones name in a string variable. </p><p>char is used to store one single character so like someones initial. </p><p>int is used to store whole numbers so someones age etc. </p><p>float is used to store numbers with decimal points so like 13.37 or 4.20. </p><p>Void is a special variable and is used for functions and pointers ONLY. </p><p></p><p>There are some rules you must know for variables: </p><p>you can not use key words so any keyword within the C library.</p><p>Variables can not contain spaces so you cant do this My Name if you done this My_Name that would be fine. </p><p> </p><p></p><p>you can also get </p><p>Long </p><p>short </p><p>sighed </p><p>unsigned</p><p></p><p>i will not be talking about them as a simple google search can tell u all u need. </p><p></p><p>i will now show you how to use the Above Variables</p><p></p><p>int main()</p><p>{ </p><p> // declaring vars </p><p> </p><p> int age = 17; </p><p> char inital = 'Z'; </p><p> char Name[6] = "Zone"; </p><p> float decimal = 13.37; </p><p> </p><p> // printing to console </p><p> printf("You are %d years old\n", age); </p><p> printf("Your Inital is %c\n", inital); </p><p> printf("Your Name is %s\n", Name); </p><p> printf("%.2f is a dank number\n", decimal);</p><p> </p><p> getchar(); </p><p></p><p>} </p><p> </p><p>%d used to print integers </p><p>%c used to print chars </p><p>%s used to print strings </p><p>%f used to print floats </p><p></p><p>with the float character conversion u can do this </p><p>%.2f prints to 2 decimal places</p><p>%f prints the full number </p><p>%.4f prints to 4 decimal places </p><p></p><p>you can mess about with it if you want <img src="/styles/default/xenforo/smilies.emoji/people/slight_smile.emoji.svg" class="smilie" loading="lazy" alt=":smile:" title="Smile :smile:" data-shortname=":smile:" /></p><p></p><p>That's really all you need to know about Variables next tutorial i will go over the scanf function <img src="/styles/default/xenforo/smilies.emoji/people/slight_smile.emoji.svg" class="smilie" loading="lazy" alt=":smile:" title="Smile :smile:" data-shortname=":smile:" /></p></blockquote><p></p>
[QUOTE="ZoneAye, post: 14538, member: 18741"] Hi guys Zone here again this is my second part of my C Programming Tutorials in this tutorial we will be looking at variables you should know what they are used for if you have done programming before but incase you don't they are used to store stuff so like someones name,age,initial etc really anything. So lets jump right into the tutorial. We will be looking at the variables below string char int or integer float void string is used to store text so you could store someones name in a string variable. char is used to store one single character so like someones initial. int is used to store whole numbers so someones age etc. float is used to store numbers with decimal points so like 13.37 or 4.20. Void is a special variable and is used for functions and pointers ONLY. There are some rules you must know for variables: you can not use key words so any keyword within the C library. Variables can not contain spaces so you cant do this My Name if you done this My_Name that would be fine. you can also get Long short sighed unsigned i will not be talking about them as a simple google search can tell u all u need. i will now show you how to use the Above Variables int main() { // declaring vars int age = 17; char inital = 'Z'; char Name[6] = "Zone"; float decimal = 13.37; // printing to console printf("You are %d years old\n", age); printf("Your Inital is %c\n", inital); printf("Your Name is %s\n", Name); printf("%.2f is a dank number\n", decimal); getchar(); } %d used to print integers %c used to print chars %s used to print strings %f used to print floats with the float character conversion u can do this %.2f prints to 2 decimal places %f prints the full number %.4f prints to 4 decimal places you can mess about with it if you want :) That's really all you need to know about Variables next tutorial i will go over the scanf function :) [/QUOTE]
Verification
Post reply
Forums
Tech Boards
Computer Programming
Source Code & Tutorial
Zone's C Programming Tutorials #2 Variables
CabConModding is now on facebook! Check the latest Updates, the Site Status and much more now!
This site uses cookies to help personalise content, tailor your experience and to keep you logged in if you register.
By continuing to use this site, you are consenting to our use of cookies.
Accept
Learn more…
Top