2014. 8. 12. 15:00
336x280(권장), 300x250(권장), 250x250, 200x200 크기의 광고 코드만 넣을 수 있습니다.

- 전역변수


프로그램 종료시 소멸






- 지역 변수


stack에 위치 

 

함수 내부에서 선언, 선언시 쓰레기값 할당 

  

함수 종료시 소멸



------------------------


#include <stdio.h>


int nA=0;


int main(){


int nB=0;

nB=nA;

FILE *fp =fopen("test2.txt", "w");


printf("nA=%d,nB=%d \n", nA,nB);

fprintf(fp,"%s", "aaaaaaa");

fclose(fp);

return 0;


}


--------------------------------------------




int global=10;


int FuncA(){

int x=0;

int y=1;


return x+y+global;


}


-------------------------------------



int main(){


int a =0;

a=FuncA();

global+=a;


printf("Global : %d \n", global);

printf("a : %d \n" , a);


return 0;



----------------------------------


- visual basic debug


F10 - 함수를 만났을때 그냥 실행만 하고 넘어감 

alt + 6    -  디버그 

shift + F5   - 디버그 나오기 


F11 - stack into

- 함수를 만났을때 함수 안으로 들어감


F9 - break point       +   F5


ctrl + F10   - 해당 커서의 위치로 곧바로 디버깅



----------------



- 구조체 


초기화없이 선언


멤버 



-------------------------------------



struct Student{

int id;

int age;

char * name;

};


int main(){

struct Student stu;^

stu.id=1001;

stu.age=18;

stu.name="kim ki";


printf("id : %d\n", stu.id);

printf("age : %d\n", stu.age);

printf("name : %s\n" , stu.name);

return 0;



}














'C / C++' 카테고리의 다른 글

FILE output coding  (0) 2014.08.18
structure and typedef which make new type of definition  (0) 2014.08.13
up and down game coding  (0) 2014.08.11
coding a basic program  (0) 2014.08.01
functions that can make some random numbers with the headers  (0) 2014.07.31
Posted by af334