C :: Copying Characters From One String To Another With Pointers?
Apr 14, 2013
So I'm writing a function isPalindrome() that can accept a string as an argument, and copy from it only the alphabetic characters in the argument (original) string to another string named alpha_array which contains only the alphabetic characters. Then the function should be able to call the isPurePalindrome function to determine if alpha_array is an ordinary palindrome.
The problem is that when I call isPalindrome in main, the program crashes.
Here's the code I have for isPurePalindrome and isPalindrome:
Code:
/* 1 */
int isPurePalindrome( const char * sentence ) // Can accept strings, array and pointer arguments
{
// Declarations
[Code].....
View 4 Replies
Jan 31, 2014
I was trying to copy one array to another one of the same size, but when I execute the program all the array values that are supposed to be copied appeared to be 0 when it should be 10, what am I doing wrong?
#include <iostream>
#include <cstdlib>
using namespace std;
int a[10];
int b[10];
void print(int *, int);
void zeros (int *, int);
[Code]...
View 1 Replies
View Related
Jun 6, 2014
How to make a C function, that will be copying string to the clipboard?(so during execution it copies to cliboard, and after the program ends its execution I will be able to do "Ctrl-V" and paste the things copied)?.
I assume that linux have some sort of in-kernel clipboard which can be filled with some systemcall?
View 4 Replies
View Related
Sep 26, 2013
I'm having trouble with this code. What I'm trying to do is to read a line from a file and cut that line into two pieces, one is the keyword and the other is the definition. I want to read up to when there is a dash and assign that line to key and then assign the rest of the line to def. After that I copy key to the struct DictEntries.key and def to DictEntries.def. The output of this shows only the definition for both DictEntries.key and DictEntries.def but if I use "puts(key);" I see the keyword.
Code:
while(!feof(dictionary))
{
char line[200];
char *key,*def;
fgets(line,sizeof(line),dictionary);
key = strtok(line,"-");
}
[code]....
View 12 Replies
View Related
Mar 20, 2014
so my question is i want to print characters,no string just an array of characters,i do this but it s not working,maybe i have to put the '' at the end?
Code:
int main() {
int i;
char ch[5];
for(i = 0; i < 5; i++) {
scanf("%c",&ch[i]);
[Code]...
View 6 Replies
View Related
Jul 6, 2014
Im supposed to find the common characters between two string characters, assuming that the user wont input duplicate letters like ddog. When I run my code I get an output of a question mark upside down. Here is my code with comments on what each part is supposed to do
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
int main(){
char str1[20], str2[20],remp = '