Sizeof usage

xiaoxiao2021-03-06  41

One about SizeOf, as follows: INT i; char f (); The following statement is wrong: (can be selected) a. Sizeof (i); b. Sizeof (int); c. Sizeof i; d. Sizeof Int; e. sizeof (f ()); the answer is: D. To verify the various possible usages of SizeOf, the following test procedures are selected for your reference. // Sizeof:

// Specify the must use parentheses ();

// The function must be added to the size of the address;

#include

Void fvoid ()

{

}

Char fchar ()

{

Return '0';

}

void main ()

{

INT I;

Printf ("% d / n", sizeof (0));

Printf ("% D / N", SIZEOF (i));

Printf ("% D / N", SIZEOF (fchar ()));

Printf ("% d / n", sizeof (& fchar));

Printf ("% d / n", sizeof (& fvoid));

Printf ("% D / N", SIZEOF (INT);

Printf ("% D / N", SIZEOF 0);

Printf ("% D / N", SIZEOF I);

Printf ("% d / n", sizeof fchar ());

Printf ("% D / N", SIZEOF & FCHAR);

Printf ("% d / n", sizeof & fvoid;

// Printf ("% d / n", sizeof int); // compile error

// Printf ("% d / n", sizeof (fchar)); // compile error

// Printf ("% d / n", sizeof fchar); // compile error

// Printf ("% d / n", sizeof (fvoid ())); // compile Error

// Printf ("% d / n", sizeof fvoid ()); // compile Error

}

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

New Post(0)