"Good Programmer's note sharing" C language variables

Source: Internet
Author: User

iOS training------My C language notes, look forward to communicating with you!

#include <stdio.h>/*1. Variable type variable name; int score; 2. Assignment of variables score = 100; Score = A; Score = b = 100; 3. The output of the variable int a = 200; printf ("%i", a); Common format characters: 1>%d\%i integer (int) 2>%f decimal (float, double) 3>%c character (char)*/intMain () {/*int score;    Assignment operation (initialization) score = 1000;    Score = 10000;    char c;    c = ' A ';    int a = 20;    int d,e,f;    int b;    b = A = 40; b = +;*/    //variables: As long as there is indeterminate data, you should define the variables to save    intScore =205; //1:15    intTime = the; intBestscore =3161; //%d\%i is a format character (placeholder) and can only output integersprintf"score is%d\n", score); //score points are 205    floatHeight =1.78f; //%f used to output decimals, default is 6 decimal placesprintf"height is%.2f\n", height); //height is 1.75//%.2f output retains two decimal places    CharScoregrade ='D'; printf ("The integration level is%c\n", Scoregrade); //The integration level is Dprintf"score is%d, height is%f, rank is%c\n", score, height,'C'); //The score is 205, the height is 1.780000, the grade is C.    return 0;}

"Good Programmer's note sharing" C language variables

Related Article

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.