C++ and dsa

Table of contents

No heading

No headings in the article.

string copy , compare , concat question .

#include<iostream>
#include<cstring>
using namespace std;

int main() {

char a[1000] = "apple";
char b[1000];

// calc length

cout << strlen(a) << endl;

// strcpy

strcpy(b,a);
cout << b << endl;

// compare

cout << strcmp(a,b) << endl;

// strcmp

cout << strcmp(a,b) << endl;

char web[] = " www.";
char domain[] = "codingminutes.com";

strcpy(b,strcat(web,domain));

cout << b ;

cout << strcmp(b,a) << endl;

}