programplug Logo




C gets() and puts() Methods


#include    
void main()
{    
char name[10];    
    printf("Enter your name: ");    
    gets(name);   
    printf("Your name is: ");    
    puts(name);       
} 

Output
Enter your name: Rahul Bisht
Your name is: Rahul Bisht

C strlen() Method


#include
void main()
{    
   char ch[10]={'h','e','l','l','o'};    
   printf("Length of string is: %d",strlen(ch));       
}   

Output
Length of string is:
5

C strcpy() Method


#include   
void main()
{    
   char ch[10]={'h','e','l','l','o'};    
   char ch2[10];    
   strcpy(ch2,ch);    
   printf("Value of second string is: %s",ch2);       
}   

Output
Value of second string is:
hello

C strcat() Method


#include   
void main()
{    
   char ch[10]={'h', 'e', 'l', 'l', 'o'};    
   char ch2[10]={'w','o','l','d'};    
   strcat(ch,ch2);    
   printf("Value of string is: %s",ch);       
}    

Output
Value of string is:
Value of first string is: hello world

C strcmp() Method


#include   
void main()
{    
  char s1[10],s2[10];    
  printf("Enter string 1: ");    
  scanf("%s",s1);   
  printf("Enter string 2: ");    
  scanf("%s",s2);    
  if(strcmp(s1,s2)==0)    
      printf("Strings are equal");    
  else    
      printf("Strings are not equal");    
}  

Output
Enter string 1: hello
Enter string 2: hello
Strings are equal

C strrev() Method


#include     
void main()
{    
  char s[10];    
  printf("Enter string: ");       
  printf("%s",s);    
  printf("\n Reverse String is: %s",strrev(s));       
}    

Output
Enter string:Hello
Reverse String is: olleH

C strlwr() Method


#include     
void main()
{    
  char s[10];    
  printf("Enter string: ");    
  gets(str);   
  printf("%s",s);    
  printf("\n Lower String is: %s",strlwr(s));        
}     

Output
Enter string:HELLO
Lower String is: hello

C strupr() Method


#include    
void main()
{    
  char s[10];    
  printf("Enter string: ");      
  printf("%s",str);    
  printf("\n Upper String is: %s",strupr(s));    
 return 0;    
}        

Output
Enter string:hello
Upper String is: HELLO






Our Services

Developing Cheapest Websites
Offer Digital Marketing
Provide College Projects
Attractive Website Developing
Summer Training,Industrial Training
SCO,SMO

Contact Us

Dehradun Uttarakhand India
www.programplug.com
info@programplug.com
00000000

Other Link

About Us

Contact Us

Disclaimer

Privacy Policy