Solution ST-1
Solution ST-1
#include <stdio.h>
int main() {
//1. Pointer to a character
char ch = 'A';
char *ptrChar = &ch;
return 0;
}
2.
#include <iostream>
int main()
{
const char* str1 = "We love C++ programming\n";
char str2[100];
char *p = str2; // *p points the beginning of the array str2. It's used to traverse str2 while
copying characters from str1.
while(*p++ = *str1++){} // This while loop terminates only when the NULL character of
str1 is encountered. It also copies characters from str1 to str2 one
by one.
std::cout << str2;
}
Explanation:
3.
#include <iostream>