C Programming Articles

Submit Article
Home » Articles » C Programming » Homework HelpRSS Feeds

Program of string variable

Posted By: Lola Hughes     Category: C Programming     Views: 7399

Write a program of string variable.

Code for Program of string variable in C Programming

main ( )
char s1[6];    \\ A     
char s2[6];
char ch;
int cnt = 0;
s1 = “Hello”;      \\ B
printf (“%s \n”, s1);      \\ C
s2 = {‘H’, ‘e’, ‘l’, ‘l’, ‘o’}    \\ D
printf(“%s \n”, s2);           \\ E
while (  (ch = getchar() )! = ‘#’ && (cnt < 6-1) )        \\ F
     s1[cnt++] = ch;        \\ G
     s1[cnt] = ‘\0’;        \\ H

Didn't find what you were looking for? Find more on Program of string variable Or get search suggestion and latest updates.

Lola Hughes
Lola Hughes author of Program of string variable is from London, United Kingdom.
View All Articles

Related Articles and Code:

Please enter your Comment

  • Comment should be atleast 30 Characters.
  • Please put code inside [Code] your code [/Code].

No Comment Found, Be the First to post comment!