0 votes 0 votes According to me Option D. Because it should be an error because *("INDIA" + 2 ) = 'D' and we are doing 'D' = 'I' which is not valid so Error ??? But answer is C Programming in C ace-test-series data-structures array + – Na462 asked Jun 29, 2018 edited Mar 3, 2019 by I_am_winner Na462 581 views answer comment Share Follow See all 5 Comments See all 5 5 Comments reply Show 2 previous comments Naveen Kumar 3 commented Jun 29, 2018 reply Follow Share printf("%c",*("INDIA"+2)='I'); // 'I' printf("%s",*("INDIA"+2)='I'); // segementation fault 0 votes 0 votes Anu007 commented Jun 29, 2018 reply Follow Share "INDIA" represent a base address of string constant assume address is 1000. now by doing *("INDIA"+2)='I' you are trying to modify string constant which is not allowed, Hence segmentation fault. 0 votes 0 votes None ... commented Jul 1, 2018 reply Follow Share @anu007 India is in double quote ... does it make any sense ?? 0 votes 0 votes Please log in or register to add a comment.
Best answer 3 votes 3 votes Attempting to write on Read-only location is a segmentation fault but not the error... segmentation fault means Abnormal termination of Program. read more on Segmentation fault https://en.wikipedia.org/wiki/Segmentation_fault Shaik Masthan answered Jun 29, 2018 selected Jun 29, 2018 by Na462 Shaik Masthan comment Share Follow See 1 comment See all 1 1 comment reply Na462 commented Jun 29, 2018 reply Follow Share Thanx Brother 0 votes 0 votes Please log in or register to add a comment.