10.9 write a function to transpose an integer matrix of 3*3 ., Integer 10.9

Source: Internet
Author: User

10.9 write a function to transpose an integer matrix of 3*3 ., Integer 10.9

 

# Include <stdio. h> int main () {int arr [] [3] = {1, 2, 3}, {4, 5, 6}, {7, 8, 9 }}; printf ("before change! \ N "); int I, j, t; for (I = 0; I <3; I ++) {for (j = 0; j <3; j ++) {printf ("% 3d", * (arr + I) + j);} printf ("\ n ");} for (I = 0; I <3; I ++) {for (j = 0; j <I; j ++) {t = * (arr + I) + j); * (arr + I) + j) = * (arr + j) + I); * (arr + j) + I) = t;} // printf ("after change! \ N "); for (I = 0; I <3; I ++) {for (j = 0; j <3; j ++) {printf ("% 3d", * (arr + I) + j);} printf ("\ n");} return 0 ;}

 

Result:

I made a small mistake. I used printf ('\ n') to output the line feed, and changed it to double quotation marks. The usage of printf () is attached.

1. the printf () function is a formatting output function, which is generally used to output information to the standard output device in the specified format.

2. The call format of the printf () function is: printf ("<Format String>", <parameter table> ).

3. Format output: it is a function that generates format output in C Language (defined in stdio. h ). Used to output characters to terminals (monitors, consoles, etc.

Format control consists of text and data format description to be output. In addition to letters, numbers, spaces, and digit symbols,

You can also use escape characters to indicate special meanings.

4. Purpose: generate a formatted output function (defined in stdio. h) in the C language, which outputs characters to the terminal (display, console, etc.

 

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.