自从你进入程序员的世界,就开始照着书本编写着各种helloworld,大笔一挥:

  printf("Hello World!\n");

  于是控制台神奇地出现了一行字符串,计算机一句温馨的问候将多少年轻的骚年们引入了这个比58同城还神奇的世界......

今天的旅行从这里开始:

#include <stdio.h>

int main()
{
float a = 0.5;
printf("float a is %f\n",a);
return 0;
}

第一步:进入调试,我们首先进入了printf.c中的代码:

 1 int __cdecl printf (
 2         const char *format,
 3         ...
 4         )
 5 /*
 6  * stdout 'PRINT', 'F'ormatted
 7  */
 8 {
 9     va_list arglist;
10     int buffing;
11     int retval;
12 
13     _VALIDATE_RETURN( (format != NULL), EINVAL, -1);
14 
15     va_start(arglist, format);
16 
17     _lock_str2(1, stdout);
18     __try {
19         buffing = _stbuf(stdout);
20 
21         retval = _output_l(stdout,format,NULL,arglist);
22 
23         _ftbuf(buffing, stdout);
24 
25     }
26     __finally {
27         _unlock_str2(1, stdout);
28     }
29 
30     return(retval);
31 }
View Code

相关文章:

  • 2021-11-03
  • 2022-01-21
  • 2021-11-25
  • 2021-06-10
  • 2021-12-11
  • 2021-11-21
  • 2022-12-23
  • 2022-12-23
猜你喜欢
  • 2022-12-23
  • 2022-12-23
  • 2021-08-22
  • 2022-12-23
  • 2021-12-19
  • 2022-01-07
  • 2021-04-13
相关资源
相似解决方案