how to print x number of bytes cout

Solutions on MaxInterview for how to print x number of bytes cout by the best coders in the world

showing results for - "how to print x number of bytes cout"
Nicola
27 Nov 2020
1#include <iostream>
2#include <cstring>
3
4#define x 4
5
6int main()
7{
8  const char* str = "1234567890";
9  char temp[x+1] = {0};
10  
11  std::memcopy(temp, str, x);
12  
13  std::cout << temp << std::endl;
14  
15  return 0;
16}
similar questions
queries leading to this page
how to print x number of bytes cout