Q:

C++ - Print the string character by character using pointer

belongs to collection: C++ programs on various topics

0

C++ - Print the string character by character using pointer

 

All Answers

need an explanation for this answer? contact us directly to get an explanation for this answer

Consider the following program:

#include <iostream>

using namespace std;

int main()
{
	char name[]="Priya Kaushal";
	char *ptr=name;
	
	while(*ptr!=NULL){
		cout<<*ptr;
		ptr++;
	}
	
	cout<<endl;
	return 0;	
}

Output

Priya Kaushal

 

need an explanation for this answer? contact us directly to get an explanation for this answer

total answers (1)

C++ programs on various topics

This question belongs to these collections

Similar questions


need a help?


find thousands of online teachers now
C++ program to declare, read and print dynamic int... >>
<< C++ program to print the size of different types o...