Illustrates some of the ways to represent strings in a program. - C String

C examples for String:Introduction

Description

Illustrates some of the ways to represent strings in a program.

Demo Code

#include <stdio.h>

#define MSG "this is a test."

#define MAXLENGTH 81/*from  w ww  . j  a  v a2s .  c  o m*/

int main(void)
{
    char words[MAXLENGTH] = "examples from book2s.com.";
    
    const char * pt1 = "pointer pointer.";
    
    puts("Here are some strings:");
    
    puts(MSG);
    
    puts(words);
    
    puts(pt1);
    
    words[8] = 'p';
    
    puts(words);

    return 0;
}

Result


Related Tutorials