Question
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
Get Instant Access to Expert-Tailored Solutions
See step-by-step solutions with expert insights and AI powered tools for academic success
Step: 2
Step: 3
Ace Your Homework with AI
Get the answers you need in no time with our AI-driven, step-by-step assistance
Get Started