Welcome, Guest: Register On Nairaland / LOGIN! / Trending / Recent / New
Stats: 3,154,756 members, 7,824,167 topics. Date: Saturday, 11 May 2024 at 02:08 AM

Urgent! Plz Help - C Programming Problem - Programming - Nairaland

Nairaland Forum / Science/Technology / Programming / Urgent! Plz Help - C Programming Problem (1189 Views)

Help: C Language And MPI ? (urgent Plz) / C Programming Challenge To Be Solved Under 10 Minutes (2) (3) (4)

(1) (Reply) (Go Down)

Urgent! Plz Help - C Programming Problem by lctewand(f): 11:41am On Dec 21, 2009
plz i need an urgent solution to this question,


" write a program tha enteres a line of text, stores it in an array and then displays it backwards, allow the lenght of the line to be unspecified but assume it will not exceed 80 characters and it should be ended by pressing the enter key, "

plz guyz i really need ur help cos i dont even hav an idea of where to start from,
Re: Urgent! Plz Help - C Programming Problem by Ogim: 1:39pm On Dec 21, 2009
#include <stdio.h>
#include <string.h>

int _getch(void);

Void main()
{
char str[80];
int len;
scanf("%s",str);
len=strlen(str);
int i,j;
char temp;
for (i=0,j=len-1;i<j;i++,j--)
{
temp=str[i];
str[i]=str[j];
str[j]=temp;
}
printf(str);
_getch();
}
Re: Urgent! Plz Help - C Programming Problem by Ogim: 1:41pm On Dec 21, 2009
#include <stdio.h>
#include <string.h>

int _getch(void);

Void main()
{
char str[80];
int len;
scanf("%s",str);
len=strlen(str);
int i,j;
char temp;
for (i=0,j=len-1;i<j;i++,j--)
{
temp=str[i];
str[i]=str[j];
str[j]=temp;
}
printf(str);
_getch();
}
Re: Urgent! Plz Help - C Programming Problem by candylips(m): 3:12pm On Dec 21, 2009
@poster

you should be doing your home work assignment yourself smiley
Re: Urgent! Plz Help - C Programming Problem by lctewand(f): 10:30pm On Dec 21, 2009
@ candylips
thanks but i didnt know what 2 do so i had 2 come 2 d masters grin
@ ogim thanks a lot
am running it now nd i think its correct cos its only givin me 1 error which i think is due 2 my compiler,
Re: Urgent! Plz Help - C Programming Problem by javalove(m): 2:09pm On Dec 25, 2009
that question is from "k&r", if your lecturer gave you the question, he must be lazy or he wants you all to pass.
Re: Urgent! Plz Help - C Programming Problem by lctewand(f): 7:57am On Dec 30, 2009
javalove:

that question is from "k&r", if your lecturer gave you the question, he must be lazy or he wants you all to pass.

sorry what is k&r
Re: Urgent! Plz Help - C Programming Problem by Ogim: 9:38am On Dec 30, 2009
Kernighan & Ritchie also known as K & R where the once who design the original c language.
If you realy want to learn c programming start with the free books at
http://cslibrary.stanford.edu/

(1) (Reply)

Microcontroller Training Info. / [PHP] Fastest Way To Connect To Your Database And Retrieve Your Values! / This Is My 1st Web App Ever - A Search Engine For Africans

(Go Up)

Sections: politics (1) business autos (1) jobs (1) career education (1) romance computers phones travel sports fashion health
religion celebs tv-movies music-radio literature webmasters programming techmarket

Links: (1) (2) (3) (4) (5) (6) (7) (8) (9) (10)

Nairaland - Copyright © 2005 - 2024 Oluwaseun Osewa. All rights reserved. See How To Advertise. 10
Disclaimer: Every Nairaland member is solely responsible for anything that he/she posts or uploads on Nairaland.