Find Jobs
Hire Freelancers

Bit-level operations used in system programming

$25-30 USD

Abgeschlossen
Veröffentlicht vor etwa 20 Jahren

$25-30 USD

Bezahlt bei Lieferung
Objective: In this assignment, you will do some bit-level operations, commonly used in system programming. DESCRIPTION Part-1 ------ - The left-shift operator can be used to pack two characters values into an unsigned integer variable. Write a program that inputs two characters from the keyboard and passes them to function packCharacters(). - To pack two characters into an unsigned integer variable, assign the first character to the unsigned variable, shift the unsigned variable left by 8 bit positions and combine the unsigned variable with the second character using the bitwise inclusive-OR operator. - The program should output the characters in their bit format before and after they are packed into the unsigned integer to prove that the characters are in fact packed correctly in the unsigned variable. Part-2 ------ - Using the right-shift operator, the bitwise AND operator and a mask, write a function unpackCharacters that takes the unsigned integer from first part and unpacks it into two characters. To unpack two characters from an unsigned integer, combine the unsigned integer with the mask 65280 (11111111 00000000) and right-shift the result 8 bits. Assign the resulting value to a char variable. - Then, combine the unsigned integer with the mask 255 (00000000 11111111). Assign the result to another char variable. The program should print the unsigned integer in bits before it is unpacked, then print the characters in bits to confirm that they were unpacked correctly. DisplayBits(unsigned value) function: - Write a separate function, which displays unsigned number in bits. This function can be used whenever you have to display the number in bit form. Hints: '<<' is the left shift operator and '>>' is the right shift operator in C. '|' (vertical split bar) is bitwise OR and '&' is bitwise AND operator. '^' is Exclusive-OR and '~' is not operator ## Deliverables 1) Complete and fully-functional working program(s) in executable form as well as complete source code of all work done. 2) Exclusive and complete copyrights to all work purchased. (No GPL, GNU, 3rd party components, etc. unless all copyright ramifications are explained AND AGREED TO by the buyer on the site per the coder's Seller Legal Agreement). ## Platform Unix
Projekt-ID: 3093763

Über das Projekt

4 Vorschläge
Remote Projekt
Aktiv vor 20 Jahren

Möchten Sie etwas Geld verdienen?

Vorteile einer Ausschreibung auf Freelancer

Legen Sie Ihr Budget und Ihren Zeitrahmen fest
Für Ihre Arbeit bezahlt werden
Skizzieren Sie Ihren Vorschlag
Sie können sich kostenlos anmelden und auf Aufträge bieten
Vergeben an:
Avatar des Nutzers
See private message.
$7 USD in 3 Tagen
4,7 (7 Bewertungen)
2,2
2,2
4 Freelancer bieten im Durchschnitt $14 USD für diesen Auftrag
Avatar des Nutzers
See private message.
$17 USD in 3 Tagen
5,0 (23 Bewertungen)
3,4
3,4
Avatar des Nutzers
See private message.
$17 USD in 3 Tagen
5,0 (2 Bewertungen)
0,7
0,7
Avatar des Nutzers
See private message.
$15,30 USD in 3 Tagen
0,0 (3 Bewertungen)
0,0
0,0

Über den Kunden

Flagge von UNITED STATES
United States
4,9
11
Mitglied seit Feb. 5, 2004

Kundenüberprüfung

Danke! Wir haben Ihnen per E-Mail einen Link geschickt, über den Sie Ihr kostenloses Guthaben anfordern können.
Beim Senden Ihrer E-Mail ist ein Fehler aufgetreten. Bitte versuchen Sie es erneut.
Registrierte Benutzer Veröffentlichte Jobs
Freelancer ® is a registered Trademark of Freelancer Technology Pty Limited (ACN 142 189 759)
Copyright © 2024 Freelancer Technology Pty Limited (ACN 142 189 759)
Vorschau wird geladen
Erlaubnis zur Geolokalisierung erteilt.
Ihre Anmeldesitzung ist abgelaufen und Sie wurden abgemeldet. Bitte melden Sie sich erneut an.