Small projects in C using string

Basics on String
NoDetils
1Receive a string and then display the same.
2Find the length of the string without using strlen() function
3Print a string with one blank space between each char
4Print a string vertically ( one line break after each char)
5Print a string in reverse order
Advance on String
NoDetils
1Copy nth char of string where nth char is a number .
2Copy a string without using strcpy() .
3Search a string for presence of a char, if found display the position
4Search a string inside a string
5String Print a string vertically ( one line break after each char
6Print a string in reverse order
7Delete a string from nth position
8Search for a char inside a string, if found display the position
9Remove last char from the string if it is a comma( ,)
10Take out part of the string starting and ending with two input chars
11Search for a string inside another string and if found display the position
12Take out part of the string starting and ending with two input strings

Delete a string from nth Position

#include <stdio.h>
#include <string.h>
int main(void){
   int i=12; // position of string to delete 
   char str[]="welcome to C programming";
   str[i]='\0';
   printf("%s ", str);
   return 0;
}

Listing of all chars of a string vertically with position of each char

#include <stdio.h>
#include <string.h>
int main(void){
   int i=12;
   char str[]="welcome to C programming";
   for(i=0;str[i]!='\0';i++){
    printf("\n i= %d => %c ",i,str[i]);
   }
   return 0;
}
Your Rating




Post your comments , suggestion , error , requirements etc here




We use cookies to improve your browsing experience. . Learn more
HTML MySQL PHP JavaScript ASP Photoshop Articles FORUM . Contact us
©2000-2019 plus2net.com All rights reserved worldwide Privacy Policy Disclaimer