retagged by
1,307 views
0 votes
0 votes
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
retagged by

1 Answer

3 votes
3 votes
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]

Answer:

Related questions

0 votes
0 votes
2 answers
1
Ishrat Jahan asked Nov 1, 2014
1,134 views
void swap(float* A1, float* A2) { float temp; if (*A1 = = *A2) return; temp = *A1; *A1 = *A2; *A2 = temp; return; }The program effort for the above module using Halstead'...