Question

The function martian() has a prototype of: void martian(int ch); and an implementation of: void (int...

The function martian() has a prototype of:

void martian(int ch);

and an implementation of:

void (int ch)

{

printf("%c" ,ch);

return;

}

it is called from main as

int md= 0x45;

martian(md);

What is printed on the screen?

Homework Answers

Answer #1
#include <stdio.h>

void martian(int ch){
    printf("%c" ,ch);
    return;
}

int main()
{
    int md= 0x45;
    martian(md);
    return 0;
}

E

HEX DIGIT DEC VALUE MULTIPLICATION RESULT
5 5 5 * 160 5
4 4 4 * 161 64
Add together all products

5 + 64 = 69

So, 0x45 in decimal is 69

ASCII value for decimal 69 is E

So, output of code is E

In other words, ASCII value for hex 0x45 is E, So code prints E

Know the answer?
Your Answer:

Post as a guest

Your Name:

What's your source?

Earn Coins

Coins can be redeemed for fabulous gifts.

Not the answer you're looking for?
Ask your own homework help question
Similar Questions
Experience with Functions Are the following statements a function header, a prototype or a function call?...
Experience with Functions Are the following statements a function header, a prototype or a function call? double calcMonthlyPmt(double amt); void displayResults() void showMenu(); showNum(45.67); area = CalArea(5,10); Write the function calls for the following headers and prototypes: void showValue(int quantity) void display(int arg1, double arg2, char arg3); pass the following to the call: int age; double income; char initial double calPay(int hours, double rate); What is the output of the following program? #include <iostream> using namespace std; void showDouble(int); //Function...
What is output? #include <stdio.h> void CheckValue(int* pointVar1, int* pointVar2) {       if (pointVar1 == NULL...
What is output? #include <stdio.h> void CheckValue(int* pointVar1, int* pointVar2) {       if (pointVar1 == NULL && pointVar2 == NULL) {       printf("Pointer is null\n");    }    else if (*pointVar2 > *pointVar1) {       printf("%p\n", *pointVar2);    }    else if (*pointVar1 > *pointVar2) {       printf("%p\n", *pointVar1);    } } int main() {    int num1 = 5;    int num2 = 9;       CheckValue(&num1, &num2);           return 0; } a. 0 b. 5 c. 9 d. Pointer is null e....
Convert the following C program to inline assembly int main(){ int i; printf("Hex Dec Oct Ch\n");...
Convert the following C program to inline assembly int main(){ int i; printf("Hex Dec Oct Ch\n"); for (i = 32; i < 256; i++){ printf("%2x %3d %3o %c\n",i,i,i,i); } return 0; } the code below shows where to do the assembly at: int main(){ int i = 0; char *hdr = "Hex Dec Oct Ch\n"; char *msg = " %2x %3d %3o %c\n"; printf("%s\n",hdr); ———asm{ // DO ASSEMBLY HERE } system("pause"); }
#include <stdio.h> extern unsigned long long sum(unsigned int *array, size_t n); int main(void) { unsigned int...
#include <stdio.h> extern unsigned long long sum(unsigned int *array, size_t n); int main(void) { unsigned int array[] = { 1, 1, 1, 3 }; unsigned long long r = sum(array, sizeof(array) / sizeof(*array)); printf("Result is: %llu (%s)\n", r, r == 6 ? "correct" : "incorrect"); return 0; } Complete the code for the line that calls the sum function. Write the sum function.
Please answer the following C question: There is a documented prototype for a function called get_a_line...
Please answer the following C question: There is a documented prototype for a function called get_a_line in the code below. Write a definition for get_a_line—the only function called from that definition should be fgetc. #include <stdio.h> #include <string.h> #define BUFFER_ARRAY_SIZE 10 int get_a_line(char *s, int size, FILE *stream); // Does what fgets does, using repeated calls to fgetc, but // provides a more useful return value than fgets does. // // REQUIRES // size > 1. // s points to...
Answer the questions based on the program given below. a) Write the function prototype of fnFunny...
Answer the questions based on the program given below. a) Write the function prototype of fnFunny function. b) Write the output produced by the above program #include <stdio.h> int main (void){       unsigned short i =4;       unsigned long j = 6 ;       short k = 2 ;       k = fnFunny ( i , j );       printf("i = %hu, j = %lu, k = %hi\n", i, j, k);       return 0; } short fnFunny (unsigned short i,...
Hello, in my programming class we have to create a function that will receive a time...
Hello, in my programming class we have to create a function that will receive a time in units of seconds and must return the equivalent time in units of hours-minutes-seconds. The function must also be called from main. I have attached what I have so far if someone could help me finish it that would be great.   int convert(void); int main() {    int time;    time = convert();    printf("Hour:Minute:Seconds is %d\n", time);       return 0; } int...
Please explain what will be printed out at LINE1 and LINE2? #include <stdio.h> #include <types.h> int...
Please explain what will be printed out at LINE1 and LINE2? #include <stdio.h> #include <types.h> int data[4] = {1,3,5,7}; void *runner (void *param); int main(int argc,char *argv[]) { pid_t pid; pthread_t tid; pid = fork(); if (pid==0){ pthread_create(&tid,NULL,runner,NULL); pthread_join(tid,NULL); for(int i=0,i<4,i++) printf("from child process, the values at i is %d",data[i]); } else if (pid>0){ wait(NULL); for(int i=0;i<4,i++) printf("from parent process, the values at i is %d",data[i]); } } void *runner(void *param){ for(int i=0;i<4,i++) data[i]+=3*i; pthread_exit(0); } } } } }
why's is my csis.txt saving ? #include <stdio.h> FILE*fp; void calculateBMI(void); int main(void) {    fp...
why's is my csis.txt saving ? #include <stdio.h> FILE*fp; void calculateBMI(void); int main(void) {    fp = fopen("csis.txt", "w"); for (int i= 0; i<4; ++i){ calculateBMI(); } fclose(fp); return 0; } void calculateBMI(void){ double weight,height,bmi;    printf("Enetr your weight in pounds:\n\n"); fprintf(fp,"Enter your weight in pounds:\n\n"); scanf("%lf",&weight); printf("Enter height in inches:\n\n"); fprintf(fp,"Enter height in inches:\n\n"); scanf("%lf",&height); bmi=(703*weight)/(height*height);    if (bmi<18.5){ printf("You have a BMI of %.lf, and your weight status is underweight\n",bmi);    fprintf(fp,"You have a BMI of %.lf, and...
Below is C code and Python code for an algorithm. C code: void foo( int n,...
Below is C code and Python code for an algorithm. C code: void foo( int n, int A, int B, int C ) { if( n==1 ) { printf("%d to %d\n",A,B); return; } foo( n-1, A, C, B ); printf("%d to %d\n",A,B); foo( n-1, B, C, A ); Python code: def foo(n , A, B, C): if n==1: print A, "to", B return foo(n-1, A, C, B) print A, "to", B foo(n-1, B, C, A) Let Hn be the number...