The first lesson of C basic usage of the printf function

Source: Internet
Author: User

printf functions:

The printf () function is a formatted output function that is typically used to output information to a standard output device in a prescribed format.

The printf () function is called in the format: printf ("< formatted string >", < Parameter table >).

#include <stdio.h>/*printf function printf ("< formatted string >", < Parameter table >)*/intMain () {intI=8, j=6; int*p=NULL; Char*name="thousand and Thousand seek"; CharPapa='Y'; intS1; P=&i; printf ("the first C program \ n"); printf ("%d%d\n", i,j);//d= output variable i,j displayed in decimal modeprintf"%p%p\n", &i,&j);//p= output Address%p=16 binary%d=10 binary in 16 binaryprintf"%d\n", *p);//d= The value of the output pointer address, displayed in decimal modeprintf"%s\n", name);//s= The characters in the output string, as to the end of theprintf"%c\n", Papa);//c= outputs a character, converted to the corresponding character in ASCII codeprintf"I love you%n\n", &AMP;S1);//%n Gets the number of output characters before the symbol, giving an int type variableprintf"%d\n", S1);//output%n the test obtainedSystem"Pause"); return 0;}

The first lesson of C basic usage of the printf function

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.