Knowee
Questions
Features
Study Tools

What will be the output of this program? (on a standard 64 bits, Linux machine)#include <stdio.h>#include <stdlib.h>#define int charint main(void){ int i; i = 5; printf ("sizeof(i) = %lu", sizeof(i)); return (EXIT_SUCCESS);}It does not compileSegmentation Faultsizeof(i) = 4sizeof(i) = 1sizeof(i) = 8sizeof(i) = 5

Question

What will be the output of this program? (on a standard 64 bits, Linux machine)#include <stdio.h>#include <stdlib.h>#define int charint main(void){ int i; i = 5; printf ("sizeof(i) = %lu", sizeof(i)); return (EXIT_SUCCESS);}It does not compileSegmentation Faultsizeof(i) = 4sizeof(i) = 1sizeof(i) = 8sizeof(i) = 5

🧐 Not the exact question you are looking for?Go ask a question

Solution

The output of this program will be "sizeof(i) = 1". This is because the '#define' preprocessor directive is used to replace 'int' with 'char' everywhere in the code. Since the size of a 'char' is 1 byte, the 'sizeof(i)' will return 1.

Similar Questions

What will be the output of the following program?

what will be the output of the c program?

What is the output of the following C Program?

What will be the output of this program? (on a standard 64 bits, Linux machine)#include <stdio.h>#include <stdlib.h>#define int charint main(void){ int i; i = 5; printf ("sizeof(i) = %lu", sizeof(i)); return (EXIT_SUCCESS);}It does not compileSegmentation Faultsizeof(i) = 4sizeof(i) = 1sizeof(i) = 8sizeof(i) = 5

What will be the output of the following C++ code?

1/4

Upgrade your grade with Knowee

Get personalized homework help. Review tough concepts in more detail, or go deeper into your topic by exploring other relevant questions.