Join the social network of Tech Nerds, increase skill rank, get work, manage projects...
 
  • Strings in C language

    • 0
    • 0
    • 0
    • 0
    • 0
    • 0
    • 0
    • 0
    • 119
    Comment on it

    String is a collection of characters in an array.It is terminated by by \0 (null character)

    There are two ways to declare string in c language.

    1)By char array

    declaring string by char array is as follows:

    char ch[10]={'e','v','o','n', '\0'};

    2)By string literal

    declaring string by string literal is as follows:

    char ch[]="Evon Tech";

    String Example

    #include <stdio.h>  
    void main ()  
    {  
       char ch[11]={'e', 'v', 'o', 'n', 't', 'e', 'c', 'h', '\0'};  
       char ch2[11]="Evon Tech";  
    
       printf("Char Array Value is: %s\n", ch);  
       printf("String Literal Value is: %s\n", ch2);  
    }  
    

 0 Comment(s)

Sign In
                           OR                           
                           OR                           
Register

Sign up using

                           OR                           
Forgot Password
Fill out the form below and instructions to reset your password will be emailed to you:
Reset Password
Fill out the form below and reset your password: