What is the output of the following code?.
Void f(){
char s1[] = "CobingBlocks";
char s2 = 'B';
char *ptr = strchr( s1, s2);
cout << ptr;
}
how the output of this problem is “Blocks”?
The output should be “Cobing” right?
What is the output of the following code?.
Void f(){
char s1[] = "CobingBlocks";
char s2 = 'B';
char *ptr = strchr( s1, s2);
cout << ptr;
}
how the output of this problem is “Blocks”?
The output should be “Cobing” right?
@nayakashutosh99 hey,the output will be Blocks as strchr is use to find the occurence of character in string ,so here character B is find in s1 string and it will give pointer to location of B ,so on printing its value whole string after B is print.Hope you get it.