Q:

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

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)

This question belongs to these collections

Similar questions


need a help?


find thousands of online teachers now