what is string or character array
#include <stdio.h>
int main()
{ int index = 0;
char name[] = {'r','o','h','i','t','\0'};
while ( name[index]!='\0'){
printf("%c", name[index]);
index++;
}
return 0;
}
************************
what is strings or character array in c
2 character array given below
#include <stdio.h>
int main()
{ int index = 0;
//char name[] = {'r','o','h','i','t','\0'};
//char surname [] = {'p','a','r','m','a','r', '\0'};
// you can choose upper 2 lines or below 2 lines but comment any two lines
char name [] = "rohit";
char surname [] = "parmar";
while ( name[index]!='\0'){
printf("%c", name[index]);
index++; }
index =0;
while ( surname[index]!='\0'){
printf("%c", surname[index]);
index++; }
return 0;
}
Comments
Post a Comment