C
-
언어별 형식 출력 함수 비교Programmer/Programming 2021. 7. 9. 12:50
언어별 형식 출력 함수와 형식 변환 지정자 C Go C++ fmt Rust Python Javascript ES6 Template literals Common Lisp 표준출력 printf( "%d", 3) fmt.Printf( "%d", 3) fmt.print( "{}", 3) print!( "{}", 3) print( "{}".format(3)) let n = 3; console.log( `${n}`) (format t "~d" 3) 파일출력 fprintf( fh, "%d", 3) fmt.Fprintf( fh, "%d", 3) fmt.print( fh, "{}", 3) write!( fh, "{}", 3) print( "{}".format(3), file = fh) let n = 3; fs.write..
-
러스트와 다른 언어의 멀티라인 처리 비교Programmer/Programming 2019. 2. 12. 14:38
새줄문자가 들어간 스트링 리터럴 출력 Rust fn main() { println!("In the rooom the women come and go, Singing of Mount Abora"); } 결과 : 스트링 리터럴의 새줄문자와 공백문자를 그대로 출력 In the rooom the women come and go, Singing of Mount Abora C #include int main() { printf("In the rooom the women come and go, Singing of Mount Abora"); putchar('\n'); } 결과 : 빌드 실패 cc -Wall -O2 -o prt_nl_str prt_nl_str.c prt_nl_str.c:5:12: warning: miss..