Follow along with the video below to see how to install our site as a web app on your home screen.
Note: This feature may not be available in some browsers.
printf( "%.5s", string );
#include <stdio.h>
#include <string.h>
int main ( ) {
char s1[] = "hello world";
char s2[] = "!";
char result[100];
strncpy( result, s1, 5 );
result[5] = '\0';
strcat( result, s2 );
strcat( result, &s1[5] );
printf("%s\n", result );
return 0;
}
#include <stdio.h>
#include <string.h>
int main( ) {
char s1[] = "hello world";
char s2[] = "!";
char result[100];
sprintf(result,"%.5s%s%s",s1,s2,&s1[5]);
printf("%s\n",result);
return 0;
}
int i = 5;
sprintf(result,"%.*s%s%s",i,s1,s2,&s1[i]);