944 views
void swap(float* A1, float* A2)
{
float temp;
if (*A1 = = *A2) return;
temp = *A1;
*A1 = *A2;
*A2 = temp;
return;
}

The program volume for the above module using Halstead's method is

1. 60
2. 63
3. 66
4. 69

Operator Frequency
if 1
* 6
== 1
return 2
= 3

Number of unique operators (n1) = 5

Number of operators (N1) = 13

Operand Frequency
temp 2
A1 3
A2 3

Number of unique operands (n2) = 3

Number of operands (N2) = 8

N = N1+N2 = 8 + 13 = 21

n = n1+n2 = 5 + 3 = 8

Program Volume (V) = N log2 n

= 21 log28

= 21*3 = 63

[float, ; and () are not considered as operators here while many places they are also considered]

by

why float, ; and () are not considered ??? and what other operator should i not consider ??

Even I have no idea. See the below slide by NPTEL- go to last page and there is an example given. In it float, ;, () and {} are all considered as operators- even "" "" also. But if we do that here, we won't be getting any answer in option.

http://nptel.ac.in/courses/106105087/pdf/m11L27.pdf

sir,

* is a unique operator here but number of * here are 6.

why you took 6 ?