5 votes 5 votes Consider the following program { int x=1; printf("%d",(*char(char*)&x)); } Assuming required header files are included and if the machine in which this program is executed is little endian, then the output will be 0 99999999 1 unpredictable Programming in C isro2018 programming output + – Arjun asked Apr 22, 2018 • retagged Dec 9, 2022 by Lakshman Bhaiya Arjun 8.6k views answer comment Share Follow See all 9 Comments See all 9 9 Comments reply Show 6 previous comments srestha commented Jun 8, 2018 reply Follow Share which year of ISRO paper is this? 0 votes 0 votes saumya mishra commented Jun 8, 2018 reply Follow Share 22 april 2018 0 votes 0 votes Ollie commented Jul 2, 2020 reply Follow Share https://www.geeksforgeeks.org/little-and-big-endian-mystery/ useful to understand Big endian and little endian. 2 votes 2 votes Please log in or register to add a comment.
Best answer 18 votes 18 votes main() { int x=1; printf("%d",(*char(char*)&x)); } Here,we will get a compilation error because 'char' is extra. If the code is : main() { int x=1; printf("%d",(*(char*)&x)); } OUTPUT: 1 option(c) VS answered Apr 23, 2018 • selected Apr 25, 2018 by Arjun VS comment Share Follow See all 6 Comments See all 6 6 Comments reply sunnykg commented Apr 23, 2018 reply Follow Share Yes u r right..then which option is correct....? 0 votes 0 votes VS commented Apr 23, 2018 reply Follow Share We can challenge this question,I suppose. 1 votes 1 votes sunnykg commented Apr 23, 2018 reply Follow Share ok..done 0 votes 0 votes cs2019 commented Apr 23, 2018 reply Follow Share I too marked it (c) i.e. 1 But due to compilation error in the actual code, none of the options is correct. 0 votes 0 votes anchitjindal07 commented Dec 1, 2018 reply Follow Share What is answer in ISRO key 0 votes 0 votes `JEET commented Jan 2, 2020 reply Follow Share Given the option then I feel Option $\mathbf{(d)}$ is safe to mark. 0 votes 0 votes Please log in or register to add a comment.
6 votes 6 votes Little endian is given, so A Vikas Yadav 1 answered Apr 22, 2018 Vikas Yadav 1 comment Share Follow See all 2 Comments See all 2 2 Comments reply elliotalderson commented Oct 25, 2019 reply Follow Share What will be the output if Big Endian was given? 0 votes 0 votes tamilselvan302 commented Nov 24, 2019 reply Follow Share if its big endian the number 1 can be represented as 00000001 00000000 00000000 00000000 if int occupies four bytes hence the answer will be 1. 0 votes 0 votes Please log in or register to add a comment.