Category: Uncategorized

Program to remove the last comma from a string using C 0

Program to remove the last comma from a string using C

Write a program in C to remove the last comma from a string. The below C program takes string having comma’s in it as input and removes the last comma from the string. The program will display the processed string on the output screen. #include <stdio.h> #include <stdlib.h> #include <string.h> int main() { //Declare all the necessary variables char *strInput=”C Programming, Tutorial site”; char *strOutput; int length = 0; int counter = 0; int flag = 0; //Get the length of input string length=strlen(strInput); //find the position of last comma for(counter = length-1; counter >=0; counter–){ if(strInput[counter]==’,’){ //position of comma...

FREE C Cheatsheet - Speed Up Your C Programming.

FREE C Cheatsheet - Speed Up Your C Programming.

Download a 7-page free cheat sheet for easy and quick access to C Concepts, Snippets, and Syntax.

Thank you! Check you inbox and access your cheat-sheet