WORKING WITH CHAR DATA TYPE AND PUTS(), STRCAT() ON C PROGRAMMING

Working with Char sample program.

#include <stdio.h>
#include <stdlib.h>
#include <string.h> // strcat

main()
{

   puts("This is the message add newline  at the end.");

   /* single char is the same as multiple char as long as there is a pointer */
   char *c = "!";
   puts(c);

   char *msg= "Pointer of strings like array[]";
   puts(msg);

   /* the above example is the same as array[] */
   char arr_msg[] = "This is an array of strings same as *msg ";
   puts(arr_msg);

   /* array of pointers to type char */
   char *msg1[3] = { "one", "two", "three" };
   puts(msg1[0]);
                                                              14,1          Top

OUTPUT:
This is the message add newline at the end.
!
Pointer of strings like array[]
This is an array of strings same as *msg
one
23
First String Added String

Advertisements
This entry was posted in C. Bookmark the permalink.

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s