6 votes 6 votes What is the output of this program? #include <stdio.h> int main() { char *ptr; char string[] = "Hello 2017"; ptr = string; ptr += 4; printf("%s",++ptr); } Hello 2017 ello 2017 2017 o 2017 Programming in C go-programming-1 programming programming-in-c pointers + – Arjun asked Oct 18, 2016 Arjun 630 views answer comment Share Follow See all 0 reply Please log in or register to add a comment.
Best answer 2 votes 2 votes ptr += 4; // leave 4 element printf("%s",++ptr); //increment pointer. i.e. leave 5 element and after that print untill null is encountered. 2017 Digvijay Pandey answered Oct 20, 2016 selected Oct 20, 2016 by Arjun Digvijay Pandey comment Share Follow See all 0 reply Please log in or register to add a comment.
0 votes 0 votes initialy ptr point to H string will be start printing after 5 character from H so o/p is 2017 SHIVAM GARG answered Aug 19, 2018 SHIVAM GARG comment Share Follow See all 0 reply Please log in or register to add a comment.