0 0 votes closed with the note: duplicate of question : https://gateoverflow.in/75183/madeeasy-test-series What is the output of this C code? Programming in C programming-in-c output pointers + – vaishali jhalani 1.0k views comment Share Follow Print See all 7 Comments 7 7 Comments reply mcjoshi commented Nov 9, 2016 reply Follow flag Maybe this helps you. 1 1 replyShare vaishali jhalani commented Nov 9, 2016 reply Follow flag Can a pointer change an array element? 0 0 replyShare Prashant. commented Nov 9, 2016 reply Follow flag yes . 0 0 replyShare vaishali jhalani commented Nov 9, 2016 reply Follow flag I read somewhere... "Using pointers we can access any particular location of an array but we can not change that location." 0 0 replyShare Prashant. commented Nov 9, 2016 reply Follow flag "Using pointers we can access any particular location of an array but we can not change that location" Thats correct we cannot change base address of an array .i.e. char p[]= "abc"; here we cant change base addrees of array. and when string stores as char *p= "abc"; then we cannot change element of this string. 0 0 replyShare vaishali jhalani commented Nov 9, 2016 reply Follow flag Can you explain it with some example? 0 0 replyShare Prashant. commented Nov 9, 2016 reply Follow flag 1. char *p= "abc"; is called as string constant means when string stored as char *p= "abc" , then we cannot update any character in given strings. i.e. string stored in read only area. so its generate error. 2. char p[]= "abc"; simple array contain string abc so here by using base address and index value we can change any character assume base address =100 i.e. *(100 +1)=d then array look like adc .but here we cannot change the base address of array i.e. if we do p = 1000 then we lost array elements and may be 1000 location assign to some other variable. so it gives error. reffer : http://www.geeksforgeeks.org/storage-for-strings-in-c/ 1 1 replyShare Please log in or register to add a comment.