STRING ARRAY IN C
C language does not support string as data type, actually string is one dimensional array of character data type in C language.
STRING ARRAY EXAMPLE - I
#include<stdio.h>
#include<conio.h>
void main()
{
clrscr();
char name[] ={'R', 'a', 'k', 'e', 's', 'h'};
printf("%s", name);
getch();
}
----------------------------
OUTPUT
----------------------------
Rakesh
STRING ARRAY EXAMPLE - II
#include<stdio.h>
#include<conio.h>
void main()
{
clrscr();
char name[40];
printf("Enter your name: ");
scanf("%s", &name);
printf("Welcome ...%s", name);
getch();
}
----------------------------
OUTPUT
----------------------------
Enter your name: Rakesh
Welcome ... Rakesh
0 Comments