Quantcast
Channel: Active questions tagged gcc - Stack Overflow
Viewing all articles
Browse latest Browse all 22102

Unable to understand _IO_puts

$
0
0

I am a computer science 1st year student and we have C programming language as one of our subjects. Since, this is my first time dealing with any programming language at all, please pardon my absolute little understanding of the basics.

So, I was trying to understand a simple Hello World program and specifically how it works internally. The program is something like this:

#include <stdio.h>

void main() {
  printf("Hello World!\n");
}

And although there are plenty of online resources that I found via Google around this topic, for example:

https://www.daniweb.com/programming/software-development/threads/448766/gdb-debugger-problem and http://osteras.info/personal/2013/10/11/hello-world-analysis.html etc.

these are pretty overwhelming and I am still trying to understand it one by one. At the moment I am stuck with the part (in most of the resources that I referred) that says that

printf

function, basically internally calls

_IO_puts

Now how does it reach all the way there, is something that I am still trying to understand and that's not my concenrn in this quesiton.

My concern is, when I looked up the _IO_puts fucntion, it shows something like this:

int _IO_puts (const char *str) 

taken from here : https://code.woboq.org/userspace/glibc/libio/ioputs.c.html

So my assumption is that all that needs to be passed to the above function is a string. But, when I look at the GDB code, I see that it shows something like this:

_IO_puts (str=0x555555554d60 "Hello World!")

Now my question is, what is str=0x555555554d60 in the above?


Viewing all articles
Browse latest Browse all 22102

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>