아데니아의 블로그

adenia.egloos.com

포토로그 마이가든


최근 포토로그


전역 변수 , 지역변수

#include <stdio.h>

int a=1;                             //  main 함수 바깥의 변수 - 전역 변수

void myprint(int m);

int main()
{
 int a=10;                          //  위의 a와는 다른 변수 아에 다름 괄호안은 a=10 이므로 a=1이 아니다
 printf("%d\n",a);
 myprint(10);
 return 0;
}

void myprint(int m)
{
 printf("%d\n",a);             // mian 함수 벗어났으므로 a=1 , m의 경우 정해지지않았기에, 모든 범위에서 찾아보다 main 함수안
 printf("%d\n",m);
}


pow()

#include <stdio.h>
#include <math.h>

int main ()
{
 printf("7^3 = %lf\n", pow((double)7,(double)3)); //pow 거듭제곱 시켜주는거 , math.h  필요
 printf("4.73^12 = %lf\n",pow(4.73,12));
 printf("32.01^1.54 = %lf\n",pow(32.01,1.54));
 return 0;
}


1 2 3 4 5 6 7 8 9 10 다음