In addition to the issues mentioned in Solutions 1 (allocating on stack) and 2 (impossible rotation of landscape format resulting in another landscape format image), the constant PI you have used is wrong: it is 3.1415926, not 3.1419265 (although you may not be able to notice a difference in the resulting images ;)
Additionally, you should be doing calculations based on floats wherever possible, or you'll accumulate rounding errors. This may result in odd artefacts if you rotate by arbitrary angles (see below).
Your code appears to be aimed at rotating an image by arbitrary angles. If that is your goal, you'll have to reverse the logic: rather than taking the original pixels and rotating them into the new position (which may be outside the frame of the new image), you should iterate over the pixels of the
target image and figure out which pixel of the original image - if any - would be rotated into this position. In many cases you'll find that a given pixel has no origin in the original image, thus you need to assign some background color to those pixels. E. g. in your example, this is true for all pixels in columns 0 to 99 and 600 to 699. In case of an arbitrary angle rotation, it takes a bit more computation.
Reversing the logic thankfully isn't so hard in case of a rotation: you'll just have to negate the rotation angle. Of course, you have to calculate the rotation correctly (one of the signs in your calculation is off).
int width = 700; int height = 500;
int background = 0;
float rads = theta*3.1415926/180.0; float cs = cos(-rads); float ss = sin(-rads);
float xcenter = (float)(width)/2.0; float ycenter = (float)(height)/2.0;
for (int r = 0; r < height; ++r) {
for (int c = 0; c < width; ++c) {
int rorig = ycenter + ((float)(r)-ycenter)*cs - ((float)(c)-xcenter)*ss;
int corig = xcenter + ((float)(r)-ycenter)*ss + ((float)(c)-xcenter)*cs;
int pixel = background; if (rorig >= 0 && rorig < height && corig >= 0 && corig < width) {
pixel = ary[rorig][corig];
}
tary[r][c] = pixel;
}
}