473,394 Members | 1,965 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,394 software developers and data experts.

from a string remove all characters of a given alphabet

#include<stdio.h>
int main()
{ int n,i,j=0;
char a[n],c[n];
char b;
scanf("%d",&n);
scanf("%s",a);
scanf("%c",&b);
for(i=0;i<n;i++)
{
if(a[i]!=b)
{
c[j]=a[i];
j++;
}
}
printf("%s",c);
}

~
~
~
Nov 1 '14 #1
3 1431
weaknessforcats
9,208 Expert Mod 8TB
Please explain a little more. I'm not sure exactly what you want to do.
Nov 1 '14 #2
donbock
2,426 Expert 2GB
I'm surprised you don't get compiler errors for declaring arrays a and c with size equal to uninitialized variable n.
How do you know the user will enter a value for n that is less than or equal to the length of the string that is entered for a?
How certain are you that you write a terminating null to array c?
Nov 1 '14 #3
ok i got the answer to my question
Nov 2 '14 #4

Sign in to post your reply or Sign up for a free account.

Similar topics

7
by: Andrzej | last post by:
Is it possible to call a function which name is given by a string? Let assume that I created a program which call some functions for example void f1(void), void f2(void), void f3(void). ...
6
by: chiara | last post by:
Hi everybody! I am just at the beginning as a programmer, so maybe this is a stupid question...Anyway,I need to write a function in C to generate generate all possible strings of given length...
4
by: ouch | last post by:
Hi Everyone, Is there any way to remove the "@" from a verbatim string? I've tried the .remove(int, int) method, but it doesn't work. Thanks ouch
4
by: Robert | last post by:
Hello. I have tried to remove the char "\" from a string that I am building in codebehind. to be used in a script tag. I have tried adding (char)34 to the string instead of the escape...
2
by: shapper | last post by:
Hello, I want to remove the first word of a string. For example: MyString = "Hello World! How are you?" I need to create 2 string: MyString1 = "Hello"
2
by: lekshminair | last post by:
dears can u help me remove last letter in a string. eg: arises in this string remove only last 's' ouput:arise
3
by: Julien | last post by:
Hi, I can't seem to find the right regular expression to achieve what I want. I'd like to remove all characters from a string that are not numbers, letters or underscores. For example: ...
1
by: encompassinc | last post by:
I am trying to parse a order export xml in PHP but I am having an issue when the xml has cardnumbers in it as they are encrypted. Below is a snippet of the xml and the error I am receiving. I am...
1
by: Sameera1 | last post by:
In c# how to remove single quotes in a string for example :-it is having '132627 then i need to remove this single quote? and make it look like this 132627
4
by: vinoth66 | last post by:
how to remove the vowels from the user input.?
0
by: ryjfgjl | last post by:
If we have dozens or hundreds of excel to import into the database, if we use the excel import function provided by database editors such as navicat, it will be extremely tedious and time-consuming...
0
by: ryjfgjl | last post by:
In our work, we often receive Excel tables with data in the same format. If we want to analyze these data, it can be difficult to analyze them because the data is spread across multiple Excel files...
0
BarryA
by: BarryA | last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
0
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can...
0
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers,...
0
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven...
0
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows...
0
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.