Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

In c int code[100]; char *P; ask the user to enter their name using decimal number from the ASCII table end with 0 to know

In c

int code[100];

char *P;

ask the user to enter their name using decimal number from the ASCII table end with 0 to know is the end of the string ;

example user input: 66 114 97 116 32 76 0

then make a for loop that would traverse the string of numbers get four numbers and store them in one index of the array int and so on you are only allow to get 4 number for each index to store in the array;

you gonna get the (first number) + (second number) * 256 + (third number) * 256 * 256 + (forth number) * 256 * 256 * 256

example math should 66 + 114*256+ 97*256*256+ 116*256*256*256 = 1952543298

so index code[0]=1952543298;

then 32+ 75*256 +0 =19232

code[1]=19232;

at the end this should print

by doing

P = (char *) &code; printf("My name is %s ",P);

Bart K

Step by Step Solution

There are 3 Steps involved in it

Step: 1

blur-text-image

Get Instant Access to Expert-Tailored Solutions

See step-by-step solutions with expert insights and AI powered tools for academic success

Step: 2

blur-text-image

Step: 3

blur-text-image

Ace Your Homework with AI

Get the answers you need in no time with our AI-driven, step-by-step assistance

Get Started

Recommended Textbook for

Advances In Databases And Information Systems Uropean Conference Adbis 2020 Lyon France August 25 27 2020 Proceedings Lncs 12245

Authors: Jerome Darmont ,Boris Novikov ,Robert Wrembel

1st Edition

3030548317, 978-3030548315

More Books

Students also viewed these Databases questions