puts的功能更加单一,只能输出字符串:printf的功能更加广,可以格式化数据,输出多种类型的数据. puts()函数用来向标准输出设备(屏幕)写字符串并换行. 调用方式为puts(string):其中,string是字符串字符(字符串数组名或字符串指针). # include <stdio.h> int main(){ string a = "happy new year!"; puts(string); return 0; } printf()函数是格式化输出函数,一
ruby学习笔记-puts,p,print的区别 共同点:都是用来屏幕输出的. 不同点:puts 输出内容后,会自动换行(如果内容参数为空,则仅输出一个换行符号):另外如果内容参数中有转义符,输出时将先处理转义再输出p 基本与puts相同,但不会处理参数中的转义符号print 基本与puts相同,但输出内容后,不会自动在结尾加上换行符 1 2 3 4 5 6 7 s = "aaaa\nbb\tbb" p s p "****************" puts s
共同点:都是用来屏幕输出的. 不同点: puts 输出内容后,会自动换行(如果内容参数为空,则仅输出一个换行符号):另外如果内容参数中有转义符,输出时将先处理转义再输出 p 基本与puts相同,但不会处理参数中的转义符号 print 基本与puts相同,但输出内容后,不会自动在结尾加上换行符 s = "aaaa\nbb\tbb" p s p "****************" puts s p "****************" prin
printf( ) - write a formatted string to the standard output stream (ANSI). logMsg( ) does not actually perform the output directly to the logging streams, but instead queues the message to the logging task, logMsg( ) can be called from interrupt serv