Pages

Monday, April 21, 2025

CStrings Functions in C++ (Strcpy)

 #include <iostream>

#include <cstring>

using namespace std;



int main()

{

    char str1[100];

    // str1 = "apna college";

    char str2[100]="hello world";

    

    strcpy(str1, str2); // strcpy(dest, src)

    

    cout << str1 << endl;

    return 0;

}

No comments:

Post a Comment

3Sum - Leetcode solution - How i turned into two-pointer approach?

  class Solution {     public List < List < Integer >> threeSum ( int [] nums ) {         Arrays . sort (nums); // first sort...