You have an int array with n elements and a structure with
three int members.
ie
struct No
{
unsigned int no1;
unsigned int no2;
unsigned int no3;
};
Point1.Lets say 1 byte in the array element is represented
like this - 1st 3 bits from LSB is one number, next 2 bits
are 2nd no and last 3 bits are 3rd no.
Now write a function, struct No* ExtractNos(unsigned int *,
int count)
which extracts each byte from array and converts LSByte in
the order mentioned in point1.and save it the structure
no1, no2, no3.
in the function struct No* ExtractNos(unsigned int *, int
count), first parameter points to the base address of array
and second parameter says the no of
elements in the array.
For example: if your array LSB is Hex F7 then result no1 =
7, no2 = 2, no3 = 7. In the same way convert all the
elements from the array and save the result in array of
structure.
Answer Posted / vadivel t
Hi small mistake.
change the
printf("ELEMENT IN THE STRUCTURE \n", (i+1));
to
printf("ELEMENT IN THE STRUCTURE %d\n", (i+1));
| Is This Answer Correct ? | 0 Yes | 2 No |
Post New Answer View All Answers
What are keywords in c with examples?
What is a constant and types of constants in c?
What is the package for freshers(Non IIT) in amazon(hyderabad). And what is the same for those who are a contract employee.
What are c identifiers?
Explain what is wrong with this program statement? Void = 10;
How can I generate floating-point random numbers?
What are actual arguments?
What is difference between array and pointer in c?
What is #include stdio h and #include conio h?
What are external variables in c?
What is string constants?
What are the usage of pointer in c?
What is a void pointer in c?
What is null pointer in c?
I came across some code that puts a (void) cast before each call to printf. Why?