It might help to be less confusing if you interperet = as gets and == as is
for Example try looking at your code like this:
PHP Code:
#include <stdio.h>
#include <math.h>
int square(int);
int main(void){
int num;
printf("Hello, World!\n");
num = square(5); /* num gets the value of 5 squared */
printf("5 squared is is %d\n\n", num);
/* and extra example */
if ( num == 22){
printf("Num is 22\n");
}
else
printf("Num is not 22, it's really %d", num);
getchar();
return 0;
}
int square(int n){
return(n * n);
}
Also. My math is pretty bad but your function returns the square of n. if you want the square root of a number. Include <math.h> an use the the sqrt() function.
Hope that helps a bit.