In the main function
a and b are constant pointers actually they are the address of the first elements. They are like l-value. you cannot copy to l-value but you can change the value of the integers they point to.
In the foo function
a and b are pointers. so you can change their values.