473,387 Members | 1,495 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,387 software developers and data experts.

Mr program is compiling but not running correctly ... please help

2
#include <stdio.h>
#include <string.h>
#define SIZE 80

int main ()
{

char word[SIZE];
int i;
int length =0;
int palindrome ;


printf("Please enter a word\n");
//printf("terminated by -1\n");
//do
// {
scanf("%s", word);
i++;
//}
//while

(word[i-1] != -1 && i < SIZE);
// length = i -1;

for (i=0; i < length/2 && palindrome == 1 ;i++)
{
if (word[i] != word[length - i - 1]) /*test if not the same */
palindrome = 0;
}


if (palindrome == 1)
printf("array is a palindrome\n");
else
printf("array is not a palindrome\n");
return 0;
}
Oct 31 '06 #1
3 1560
Banfa
9,065 Expert Mod 8TB
What is it supposed to do?

What does it actually do?
Nov 1 '06 #2
JILIAN
2
What is it supposed to do?

What does it actually do?

IT is supposd to find out if a word is a palindrome or not
Nov 1 '06 #3
horace1
1,510 Expert 1GB
before the for() statement you need to initialse the variables
length=strlen(word);
palindrome=1 ;
Nov 1 '06 #4

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

Similar topics

1
by: Will Stuyvesant | last post by:
I never used the popen or popen2 libraries but it is my understanding that they can capture the output of console based programs. Is it also possible to send keystrokes to console base programs? ...
27
by: hpy_awad | last post by:
I wrote that program from a book that my compile that program correctly under C++ compiler but I got those errors for compiling under unix !! Errors- --------...
4
by: Denise Mills | last post by:
Hi, On my previous Windows 98 machine, I wrote a simple C program that takes two text files as input, performs some calculations, then produces a text file that contains the results. It worked...
20
by: Francine.Neary | last post by:
I am learning C, having fun with strings & pointers at the moment! The following program is my solution to an exercise to take an input, strip the first word, and output the rest. It works fine...
5
by: rasmidas | last post by:
I have written a file as below: #include<stdio.h> #include<string.h> #include<stdlib.h> int main() { char* items; int i; for(i=0;i<2;i++)
62
by: Ajinkya | last post by:
As "spawnl" executes an exe through C code., similarly how can we compile a C program through another C program (on Windows platform) ?
3
by: Nanoooo | last post by:
hello, I have to do the program for the bounded buffer problem in UNIX C and what I have so far is the following code #include"genSema.h" #include<stdlib.h> #include<stdio.h>...
2
by: kwai | last post by:
Hi everyone . I have a XP Sr3 PC and and running Dev C++ .My program is compiling with no errors but gives an windows error when run.Program has encountered a problem and will be closed etc. The Dev...
0
by: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
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?
1
by: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...
0
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...
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...

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.