Solution 1:
The program is as follows:
#include
main( )
{
char name[10]’
int i;
printf(“\nPlease enter your name:”);
for(i=0; i< 10; i++)
scanf(“%c”, &name[i]);
printf(“\nEchoing…..”);
for(i=0; i<10; i++)
printf(“%c”, name[i]);
}
OUTPUT (after running):
Please enter your name: Dr. RAJIV
Echoing … Dr. RAJIV
How to Initialize a Character Array
Like an array of ints or floats or doubles, we can also initialize an array of chars during its
Do'stlaringiz bilan baham: