C/C++ :: String Printed With Extra Characters Form Nowhere
Oct 18, 2014
This code is printing out "hello worldProgr-ยก'*/"
Why is it adding those extra characters? And how can I free "lowerString" while still being able to return the value?
#include <ctype.h>
#include <string.h>
#include <stdlib.h>
#include <stdio.h>
char* tokenToLowerCase(char*);
[Code] ....
View 8 Replies
Feb 3, 2013
#include<iostream.h>
#include<conio.h>
#include<stdio.h>
void count();
void main() {
char c[100];
cout<<"Enter a string upto 99 characters(spaces included):"<<endl;
[Code] ....
The thing is, when I don't create a prototype of count and straightaway define it before void main() my program runs, but it gives error in this program that "extra parameter in call to count()" But what to do then?
View 2 Replies
View Related
Mar 4, 2015
#include<iostream.h>
#include<conio.h>
void main() {
clrscr();
char name[5];
cout<<"Enter your name";
cin>>name;
cout<<"Your name is"<<name;
getch();
}
In the above program the size of the array of the variable name is 5. which means the variable cant store more than 5 characters.
which also means
If I give the string "LINISH"
It should only print LINIS
But while the program is running, Even if I type a 10 characters string, It is getting printed Completely..why?
#include<iostream.h>
#include<conio.h>
void main(){
clrscr();
char name[5];
[Code] .....
In this program when I input a string for the variable name,It is getting printed completely, irrespective how many characters are there in the string.But If the string (which is input to the second variable that is game )holds more than 5 characters. the input of the first variable(name) is getting disturbed..why?
look at the below cited output to be more clear about my doubts.
OUTPUT NO:1
Enter your name:LINISHFRANCIS (Note that the input holds more than five chars)
Enter your game:GOLF(input is less than five chars)
LINISHFRANCIS loves GOLF(Two inputs are getting printed comopletely)
OUTPUT NO:
Enter your name:LINISHFRANCIS (Note that the input holds more than five chars)
Enter your game:FOOTBALL(input is more than five chars)
ALL loves FOOTBALL [Note that "ALL" is the last three letters of FOOTBALL
I am using TurboC++ for windows 7
View 5 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 = '