Using proper indexing would fill up your sum
rows and columns too, try:
for(r=0; r<n; r++){ //Where it should start summing
for(c=0; c<n; c++){
magic[r][n]+=magic[r][c];}
}
for(c=0; c<n; c++){
for(r=0; r<n; r++){
magic[n][c]+=magic[r][c];}
}
for(r=0; r<n; r++){
magic[n][n]+=magic[r][r];
}
for(r=0; r<n; r++){
c = n - r + 1;
diag+=magic[r][c];} //where it should stop summing