Question: #include #include #include int main() { char line[1024]; int len; int val; char *p; if((fgets(line, sizeof(line), stdin)) != NULL) { p = fgets(line, 1024, stdin);

#include #include #include

int main() { char line[1024]; int len; int val; char *p;

if((fgets(line, sizeof(line), stdin)) != NULL) { p = fgets(line, 1024, stdin); /* read a line from standard input */ len = strlen(line); strcpy(line, " 65 0x36"); /* give line a new value */ p = &line[3]; } sscanf(p, "%d", &val); printf("val=%d%c ",val,val); p = &line[8]; sscanf(p, "%d", &val); printf("val=%d%c ", val,val);

I am trying to write a program that reads in a decimal or hexidecimal number and transforms it to the ascii value. I am not sure where to go from here so any help would be appreciated.

Step by Step Solution

There are 3 Steps involved in it

1 Expert Approved Answer
Step: 1 Unlock blur-text-image
Question Has Been Solved by an Expert!

Get step-by-step solutions from verified subject matter experts

Step: 2 Unlock
Step: 3 Unlock

Students Have Also Explored These Related Databases Questions!