scanf_s

Programming/C,C++ 2017. 1. 4. 12:22

scanf 대신에 scanf_s을 사용하자!


#include <stdio.h>

#include <conio.h>


void print_star (int line)

{

int i, j;


for (i=0; i<line; ++i) {

for (j=0; j<i; ++j) {

printf ("*");

}

printf("\n");

}

}


int main (void)

{

int line = 0;


printf ("출력할 라인 수를 입력하시요? ");

scanf_s ("%d", &line);


print_star (line);


getch ();


return 0;

}


=====================

출력할 라인 수를 입력하시요? 10


*

**

***

****

*****

******

*******

********

*********

'Programming > C,C++' 카테고리의 다른 글

Multithreading Applications in Win32  (0) 2017.01.05
multithread in windows  (0) 2017.01.04
scanf 주의사항  (0) 2017.01.04
Hello, World  (0) 2017.01.03
what does "int& a = b" mean?  (0) 2016.05.10
Posted by 루나s
,