| | |
wrong output in c program
Please support our C++ advertiser: Intel Parallel Studio Home
![]() |
•
•
Join Date: Nov 2004
Posts: 1
Reputation:
Solved Threads: 0
I am very new to c/c++ programming. i was writing a few lines of code and after compiling and running the program i did not receive the desired output. can you please help me in this matter.
/* Test.c */
#include <stdio.h>
main()
{
char i[30];
clrscr();
printf("Enter a name: ",i);
scanf("%s",i);
printf("The name is %s",i);
}
When I run the above program It prompts me to enter the name.
If I enter:
Debashish
(Debashish is my name).
it will display:
The name is Debashish
But if I enter:
Debashish Gupta
(My Full Name)
It will display Debashish and not Debashish Gupta.
Can anyone please tell me where am i wrong.
/* Test.c */
#include <stdio.h>
main()
{
char i[30];
clrscr();
printf("Enter a name: ",i);
scanf("%s",i);
printf("The name is %s",i);
}
When I run the above program It prompts me to enter the name.
If I enter:
Debashish
(Debashish is my name).
it will display:
The name is Debashish
But if I enter:
Debashish Gupta
(My Full Name)
It will display Debashish and not Debashish Gupta.
Can anyone please tell me where am i wrong.
![]() |
Similar Threads
- wrong output (C++)
- wrong output (C++)
- Is it wrong to have a very long program if i did not find another way? (C++)
Other Threads in the C++ Forum
- Previous Thread: Help me out............
- Next Thread: [Q] Generating compile time error when sizeof(int) != 4
| Thread Tools | Search this Thread |
api array based binary bitmap c++ c/c++ calculator char char* class classes code coding compile console conversion count database delete deploy desktop developer directshow dll download dynamic dynamiccharacterarray email encryption error file forms fstream function functions game givemetehcodez google graph gui homeworkhelp iamthwee ifstream input int java lib linkedlist linker linux list loop looping loops map math matrix memory multiple news node number numbertoword output pointer problem program programming project python random read recursion recursive reference return rpg sorting string strings temperature template templates test text text-file tree unix url variable vector video visualstudio win32 windows winsock word wordfrequency wxwidgets





