Writing String in C

printf function used with %s print string to the screen.the format %s can be used to display an array of characters that is terminated by the null character.for example statement.

printf("%s",name);

the above statement are used to display the entire contents of the arra name.we can also specify the precision with wich the array is displayed.for example you can used %10.4 indicates that the first four character are to be printed in a field with of 10 columns.

Example


#include<stdio.h>
#include<conio.h>

void main()
{
	char company_name[20] = "Veewom Technology";
	clrscr();
	
	printf("\n\n");
	printf("%s",company_name);
	
	getch();
}						
							
Share Share on Facebook Share on Twitter Share on LinkedIn Pin on Pinterest Share on Stumbleupon Share on Tumblr Share on Reddit Share on Diggit

You may also like this!