How to print the print first 3 characters from a string in C

1 Answer

0 votes
#include <stdio.h>
  
int main()
{
    char str[] = "c java c++ python c# php";
    
    printf("%.3s\n", str);
  
    return 0;
}
  
  
  
  
/*
run:
      
c j
      
*/

 



answered Jun 3, 2023 by avibootz

Related questions

1 answer 131 views
1 answer 103 views
1 answer 124 views
1 answer 187 views
1 answer 128 views
1 answer 145 views
1 answer 223 views
...