Pages

Monday, June 13, 2016

String Initialization

C Program To demonstrate String Initialization

#include <stdio.h> 
#include<string.h>
int main () 

char name[10];
name[0]='H';
name[1]='E';
name[2]='L';
name[3]='L';
name[4]='O';
name[5]='\0';
printf("Greeting message: %s", name); 
return 0;
}

Output of program

HELLO

No comments:

Post a Comment