+ 3
How to print string using array
3 Antworten
+ 5
Although you can display a string directly using printf() or "cout"
But if you want to use the array method then
Consider string as a character array ending at NULL('\0') character and display it like a normal array.
like this 👇
for(int i = 0 ; arr[i] != '\0' ; i++)
{
cout<<arr[i];
}
+ 3
Suppose you want to print a string name big:
to print big:
In C:
printf("%s",big);
In C++:
cout<<big;
0
And in java:
System.out.println("big");