TopBottom

Followers



Click on more
SUBSCRIBE

Enter your email address:

Delivered by FeedBurner



VIDEO

Announcement: wanna exchange links? contact me at ravikrak@yahoo.com

Mixed Data Types in C language

Posted by Ravi Kumar at Sunday, September 11, 2011
Share this post:
Ma.gnolia DiggIt! Del.icio.us Yahoo Furl Technorati Reddit

Mixed Data Types in C language:


It ispermitted to mix data types in one printf statement:
printf("%d%f%s%c",a,b,c,d);
printf uses its control string to decide how many variables
to be printed and what their types are.
Program: /* printing of characters and strings*/
main()
{
char x='A'
static char name[20]="ANIL KUMAR";
printf("%c\n%3c\n%5c\n",x,x,x);
printf("%3c\n%c\n",x,x,x);
printf("\n");
printf("OUTPUT OF STRINGS\n\n");
printf("%s\n",name);
printf("%20s\n",name);
printf("%.5s\n",name);
printf("-20.10s\n",name)
printf("%5s\n",name);
}

Output: output of characters
A
A
A
A
A

output of strings
ANIL KUMAR GUPTA
ANIL KUMAR GUPTA
ANIL KUMAR
ANIL
ANIL KUMAR
ANIL KUMAR GUPTA


note: There are some space errors in the output, because blogger does not allow too much space between characters. Execute the program in ur system

Share |

Labels:

0 comments:

Post a Comment