Ratlam, , India
DBMS, SQL Server, C Language
1 टिप्पणी करें | 23 लोगो ने देखा है | 07 जुलाई 14  | Amit Bisht
Understanding Printf()
This blog is to explain the behaviour of printf function used in c language. I start with basic description of printf function . printf is defined in stdio.h header file. Itis used to print something on the console screen. As mentioned printf is a function then as we know any function have a return type and the number of arguments are optional. So the question arises what is return type of function printf Syntax int printf const char format,arguments, ... So we clear now from the syntax that return type of priintf is int . Now the next question arises what does it return well discuss it later in the same blog but before it let me explain you how printf actually works. Example 1 printfHello world output Hello world Example 2 int i 10 printfPrinting value of variable i d, i output Printing value of variable i 10 Example 3 Important int i 10 printfd,d,d,i,i,i output 12,12,10 This output is because of left to right argument passing in function. I must say now you got aware about how function really works. Now iits turn to explain what a printf function returns The answer is it returns the number of character it prints. Example 4 int i printfHello world printfn Return value by above function is d,i output Hello world Return value by above function is 11. //Hello -gt 5 Blank space in between hello world -gt 1 world -gt 5 11 Note Escape sequence like n t a conted as single character. I hope this blog may help you. So please comment if it is helpfull and also correct me wherever im wrong.

    • इस ब्लॉग के लिए सामाजिक शेयर

पोर्फोलिओ और ब्लॉग
Amit Bisht विभिन्न कंपनियों का अनुसरण करता है, ये कंपनियां और नियोक्ता Amit के फिर से शुरू देख सकते हैं
सबसे अच्छा नौकरी के अवसर पाने के लिए अपना फिर से शुरू करें अपलोड करें

मुफ्त रजिस्टर करें!