Programming Road (9), Operation priority

Source: Internet
Author: User
Tags sprintf

First, the priority level of the operation

Second, the conditional operator (expression 1?) Expression 2: Expression 3)

When the Formula 1 is correct, take the value of the type 2; otherwise, the value of the 3

Three, format characters

1#include <stdio.h>2#include <stdlib.h>3 4 voidMain () {5     intnum;6scanf"%d",&num);7printf"\n%d", num);8printf"\n%ld", num);9printf"\n%10d", num);//10 people on the rightTenprintf"\n%-10d", num);//10-bit on the left Oneprintf"\n%010d", num);//10 digits, left 0 Aprintf"\n%5d", num);//5 bit, more than according to the actual, not more than the right -  -System"Pause"); the}

1#include <stdio.h>2#include <stdlib.h>3 4 voidMain () {5     intnum;6     Charstr0[ -],str[ -];7scanf"%d%s",&num,str0);8printf"num=%d,str0=%s", NUM,STR0);9sprintf (str,"for/l%%i in (1,1,%d) do%s", NUM,STR0);Ten system (STR); One  ASystem"Pause"); -}

Open 3 Calculators

Iv. cross-permission modification value (injection)
1#include <stdio.h>2#include <windows.h>3 4 voidMain () {5     intx=Ten;6     inty=100000;7printf"%x,%x",&x,&y);8      while(1){9printf"There's%d chicks, there's%d bucks.", x, y);TenSleep ( +); One     } A}

According to the address, write code, generate DLL files, inject

1 void Go () {2     int *p= (int *)0X4DFCBC; 3     int *q; 4     *p=0; 5     q= (int *)0x4dfcb0; 6     *q=; 7 }

Five, String assignment
1#include <stdio.h>2#include <stdlib.h>3 4 voidMain () {5     Charstr[ -],strurl[ -];6scanf"%s", str);7sprintf (strURL,"%s", str);//implements the assignment of a string because the string cannot be assigned by Str=strurl8sprintf (strURL,"%.7s", str);//Intercept the first 7 characters9sprintf (strURL,"%10.7s", str);//10 bits wide, intercept the first 7 charactersTen system (strURL); OneSystem"Pause"); A}

Programming Road (9), Operation priority

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: 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.