LinuxQuestions.org

LinuxQuestions.org (/questions/)
-   Linux - Newbie (https://www.linuxquestions.org/questions/linux-newbie-8/)
-   -   printf (https://www.linuxquestions.org/questions/linux-newbie-8/printf-4175506055/)

painterdave 05-25-2014 04:04 PM

printf
 
I am learning C from Deitel C How to Program C, 6th Edition. There are things that go forward without explanation, or maybe I just missed it when I stepped out for fresh air, blinked, whatever.
In fig 6.3, line 20 what does printf ("%7d%13d\n",i,[I]); , or
The previous line 16
printf("%s%13s\n", "Element", "Value", although this one is easier to understand, because you can see the print out below it on p.166, it is still ambiguous to someone that is new.
What would work for me is to have someone go over ea. line word for word , statement for statement, function by function, loop for loop, explain every step of the way in a human language, preferably English.

bigrigdriver 05-25-2014 04:46 PM

Quote:

printf ("%7d%13d\n",i,[I])
print the integer elements of a array with a 7 char and 13 char field
with a newline feed.

Quote:

printf("%s%13s\n", "Element", "Value"
print the string elements of a array, with a newline feed.

painterdave 05-26-2014 03:49 AM

Thanks, for the quick response. I wish I had someone to walk me through this, every function, argument, loop, recursion, iteration, etc., translate it all into English, you know read the code to English, that would be awesome,

pan64 05-26-2014 04:12 AM

that is something called learning curve I think. You need to have practice by writing code and checking it and understanding. You can ask any time here if something is unclear (a specific case), but not in general. Just do it like you did yesterday....


All times are GMT -5. The time now is 08:41 PM.