+ 1

char a = "hello world" ; printf("%. 2s",a);

It's output is "he". Can we store the output in a variable.

22nd Feb 2019, 7:22 AM
David Boga
David Boga - avatar
2 Réponses
0
char buffer[SIZE]; sprintf(buffer, "%.2s" ,a);
22nd Feb 2019, 8:37 AM
code learner
code learner - avatar
0
David it's char * a
10th Mar 2019, 6:51 PM
Chipp
Chipp - avatar