Question: twos complement representation of an 8 - bit binary number. ) Functions having array parameters The following declares a function that has a parameter a
twos complement representation of an bit binary number.
Functions having array parameters
The following declares a function that has a parameter a that is an array of int :
void print
In an array parameter always decays to a pointer; in other words, the function above is equivalent to:
void print
and many traditional programmers will declare their functions in this way.
Suppose that you specify the size of the array using an int literal:
on't this
void print
can be called without a compiler warning with an int array of any size.
C slightly improved things by allowing the programmer to declare the function like so:
and recommended this
void print
called with an array having fewer than elements the compiler cannot easily do so because does not keep track of the size of dynamically allocated arrays
The functions in this question have array parameters where the minimum size of the array is declared using the static keyword.
Step by Step Solution
There are 3 Steps involved in it
1 Expert Approved Answer
Step: 1 Unlock
Question Has Been Solved by an Expert!
Get step-by-step solutions from verified subject matter experts
Step: 2 Unlock
Step: 3 Unlock
