Tuesday, 4 May 2021

String in C++ Qus - 2

 #include<stdio.h>

#include<iostream.h>

#include<conio.h>

#include<string.h>

int main()

{

clrscr();

/*char S[]={'A','B','C','\0'};

cout<<S<<endl;

char S1[6]="Hello";

char S2[6]="India";

char S3[12]=S1+S2;

cout<<S3;

 */

char *S1="Hello";

char *S2="India";

//char *S3=S1+S2;

//char *S3=

strcat(S1,S2);

cout<<S1<<endl;

cout<<S2<<endl;

//cout<<S3;

char *s4="Amit Kumar Sharma";

char s5='i';

//cout<<strchr(s4,s5);

s4=s4+3;

cout<<s4;

getch();

return 0;

}

No comments:

Post a Comment