Q:

Defining sqrt as type int in C?

So in c I'm trying to make a for loop that goes up to the square root of a number, 
but I need to define that square root as type int since the control statement can't have double types.
Basically what I did is define int1 as type int, and then have int1=sqrt(n);. 
However, the compiler isn't accepting it. Help?
Here's my entire code (it's an algorithm for Eratosthene's sieve)
http://pastebin.com/V6cHqj4F

A:

I don't see anything wrong with that. Show us your errors and read them because for example I saw that you are using j in your loops and it's never declared. Also what this code should do in your opinion?
int n, primecap[n], int1, i;
n=50;
initArray(primecap[n]);

Your problem is that you don't know what you are writing. 

A:

int int1 = sqrt(n);

This is perfectly valid in Standard C and your compiler should accept it.
Either you enabled some picky warning option in your compiler or the error is elsewhere in your program. 
(I assume you included math.h and n is of arithmetic type.)

