The entry of C is invited, otherwise don't spend time Click

zhaozj2021-02-08  266

// Simple to New Project, Run, you only need to see the effect // the relationship of pointer and address in c languness.

// created by Feb 4th, 2002 // modified by Feb 4th, 2004

#include #include #include

// if put 3, result = 3 ^ 3 3 = 12; // if 4, result = 4 ^ 4 4 = 20 ... Double SquarePlus (int A, double * b);

INT main (void) {double x = 3, y = 3, result = 0; printf ("/ n 0 ..... Y address =% p / n", & y); // print y address

// scanf (y); result = SquarePlus (3, & y); Printf ("/ n Squareplus OF% F =% 2.0F / n", x, result);

Return 0;} / *

0 ..... y address = 0012FF70 1 ..... paddress (b) = 0012FF70 2 ..... Double value (* b) = 3.000000 ... processing: (* b) * = * b;

SquarePlus of 3.000000 = 12press any key to Continue

* /

// ******************************************************** ********* // Double SquarePlus (int A, double * b) {// print the address of pointer: printf ("1 ..... paddress (b) =% p / n" , b);

// Print The ValueAfter Calcuation: Printf ("2 ..... Double Value (* b) =% f / n", * b);

// Save Before you have to change. Double k = * b; // b = & k; // [yes] if b = sth's address; // * b = sth's value;

// b IS always the result: * b = a; (* b) * = * b; // multipile itselfprintf ("... processing: (* b) * = * b; / n"); * b = * B K; // [YES] Value Itself 1; // b = b b; // [no] Just make "b" to another address;

RETURN * B; // Return (* b) * (* b) (* b); // [YES] Works also // Return B; // [no] cannot control from 'Double *' to 'double' } //http://www.eurasia.edu/bbs/ti_view.asp?fn_id=15&fc_root_id=115073&fc_id=115073

转载请注明原文地址:https://www.9cbs.com/read-2267.html

New Post(0)