char input (+1)

Oct 4, 2012 at 3:15pm
what "+1" means in scanf("%s",a+1), when i read array of chars
Oct 4, 2012 at 3:30pm
Who does read? Is it you who read? Ask yourself why are you using a + 1 in scanf.:)

I think that a is the name of the array. It is implicitly converted to the pointer to the first element of the array. So a in expressions is equivalent to &a[0]. a + 1 is the pointer to the next element of the array that is it is equivalent to &a[1].
Last edited on Oct 4, 2012 at 3:30pm
Topic archived. No new replies allowed.