C Programming - Library Functions - Discussion
Discussion Forum : Library Functions - Point Out Errors (Q.No. 3)
3.
Point out the error in the following program.
#include<stdio.h>
int main()
{
char str[] = "IndiaBIX";
printf("%.#s %2s", str, str);
return 0;
}
Discussion:
17 comments Page 2 of 2.
XYZ said:
1 decade ago
Why it is printing IndiaBIX in place of %2s?
Puneet said:
1 decade ago
The output is : %.#s %2s , string for second format %2s was also not printed why?
Vigneshwaran.L said:
1 decade ago
%.# is not operator. it is one of the symbol representation just like hex code reperesentation.like #ffff or #defe.So the linux platform (GCC )print the output is:%.0#s IndiaBix
Note:it based on machine code representation
Note:it based on machine code representation
Sowmya said:
1 decade ago
Some one plz xlpn, whats the role of %.# here??
In floating point numbers, it will tell the number of decimals, but here in a string, what does it mean??
In floating point numbers, it will tell the number of decimals, but here in a string, what does it mean??
Sundar said:
1 decade ago
Output:
In DOS 16 bit platform (Turbo C): %.#s %2s
In Linux 32 bit platfomr (GCC) : %.0#s IndiaBIX
Note: All answers given in C Programming section are based on 16-bit platform.
In DOS 16 bit platform (Turbo C): %.#s %2s
In Linux 32 bit platfomr (GCC) : %.0#s IndiaBIX
Note: All answers given in C Programming section are based on 16-bit platform.
Sms said:
1 decade ago
It prints %.#s IndiaBIX
Neeraj kumar said:
1 decade ago
How it will print like this "%.#s %2s"?
Post your comments here:
Quick links
Quantitative Aptitude
Verbal (English)
Reasoning
Programming
Interview
Placement Papers