0

Out of these two:

printf("abc\n");

and

std::cout << "abc\n";

I know the correct way to code is to use the cout line. But does the program differ from an assembly/machine code perspective? (like, one is faster, or smaller in size?) Or do both give an identical program output?

MSalters
  • 173,980
  • 10
  • 155
  • 350
ProDigit
  • 31
  • 2
  • 1
    Give it a try: [How do you get assembler output from C/C++ source in gcc?](https://stackoverflow.com/questions/137038/how-do-you-get-assembler-output-from-c-c-source-in-gcc) – pzaenger Feb 21 '20 at 10:44
  • 1
    The second one probably generates a lot more assembly code. – user253751 Feb 21 '20 at 10:47
  • 1
    [godbolt](https://godbolt.org/z/ULguJf) is a great tool for checking things like that. – super Feb 21 '20 at 10:48
  • People rating the question, don't really read it. The other topic doesn't show anything of 'machine language//assembly code'. – ProDigit Mar 06 '20 at 22:57

0 Answers0