Knowee
Questions
Features
Study Tools

What will be the output of the C program?#include<stdio.h>int main(){ char num = '\010'; printf("%d", num); return 0;}a.10b.8c.10d.8

Question

What will be the output of the C program?#include<stdio.h>int main(){ char num = '\010'; printf("%d", num); return 0;}a.10b.8c.10d.8

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

Solution

The output of the C program will be 8.

Here's why:

The character '\010' is an octal escape sequence in C. The octal number 010 is equivalent to the decimal number 8. So, when you print the value of 'num' using "%d" format specifier, it prints the decimal equivalent of the octal number, which is 8.

So, the correct answer is (b) 8.

Similar Questions

What is the output of the following C Program?

What will be the output of the C program? ans.09119011 Previous Marked for Review Next

What will be the output of the following program?

What will be the output of the following C program?#include<stdio.h>int main(){char c;c = 'A';printf("%c",c);return 0;}Select one:65Aac

What will be the output of the following program?Note: This question helps in clearing AMCAT exam.12345678910#include <stdio.h>int main() { int c = 0, e = 0; for (e = 0;e < 5; e++) { c++; if (e == 3) break; } printf("%d",c);}

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.