Tuesday 14th October 2008
 
 
 
 
 
 


 
 
1 Star2 Stars3 Stars4 Stars5 Stars (No Ratings Yet)
Loading ... Loading ...

[C] Implement of strcmp

November 16, 2006 Author: Chris T Posted in: Code Tutorials
 

A simple program to understand how to work with strings.

#include <stdio.h>
#include <stdlib.h>
 
int main(void)
{
char name[10] =  {'H','E','L','L','O'}  ;
char name2[10] = {'G','O','O','D','B','Y','E'} ; 
char temp[10] ;     
int i;
 
printf("Name 1 is %s\n",name);
printf("Name 2 is %s\n",name2);
printf("\n");
for(i=0; i<10; i++) {
 
       temp[i]= name[i];
       name[i] = name2[i]; 
       name2[i] = temp[i];
}
 
printf("After The string copy function\n");
printf("\n");   
 
printf("Name 1 is %s\n",name);
printf("Name 2 is %s\n",name2);
 
    system("PAUSE");
    return 0;   
  }
 
Views: 2,159
 

Feed for this Entry Trackback Address The permalink
 

 

Be the first to comment this entry.

 

 

Leave a Comment