| Forum |
|
|||||||
| Programming The destination for developers - C, C++, Java, Python and the lot |
![]() |
|
|
LinkBack | Thread Tools | Display Modes |
|
|
#1 (permalink) |
|
Dreamweaver
Join Date: Aug 2006
Location: Bangalore
Posts: 3,885
|
Write a Program to accept 10 numbers using one dimensional array and display them. here how i tried, but haven't executed. int a[10],i,n; printf(Enter the number of elements"); scanf("%d", &n); printf("Enter the elements"); for (i=0;i<n;i++) scanf("%d", &a[i]) and the print statement
__________________
Today's noobs are tomorrow's geeks. Don't make fun of them.. encourage them. - Gigacore Follow me on twitter.com/gigacore |
|
|
| Advertisements. Register and be a member of the community to get rid of them. | |
|
Advertisement
|
|
|
|
#2 (permalink) |
|
God of Mistakes...
Join Date: Dec 2005
Location: Pune, Maharashtra
Posts: 1,905
|
Then what is the problem ???
All the statements can work. Only problem can arise is that if I enter number of elements as >10, then it will overwrite to some other memory area.
__________________
Registered Linux User #468778 ---------------------------------- http://twitter.com/_Garbage_ |
|
|
|
|
#3 (permalink) |
|
Dreamweaver
Join Date: Aug 2006
Location: Bangalore
Posts: 3,885
|
EXECUTED, its working.
+++ RESOLVED +++
__________________
Today's noobs are tomorrow's geeks. Don't make fun of them.. encourage them. - Gigacore Follow me on twitter.com/gigacore |
|
|
|
|
#4 (permalink) |
|
Hey here is the aks
Join Date: Jan 2006
Location: punjab
Posts: 801
|
after ur last statement i.e.scanf statement there will be a ; semicolon
and ya when value is n is less than 10 then it will work surely but if input value of n greater than 10 then it will produce errors as that will be on garbage addresses
__________________
yours truly arun The aks!! have a nice day |
|
|
![]() |
| Bookmarks |
| Thread Tools | |
| Display Modes | |
|
|
Similar Threads
|
||||
| Thread | Thread Starter | Forum | Replies | Last Post |
| How to use a FTP program? | Anindya | Software Q&A | 1 | 22-03-2007 12:52 AM |
| c program | saro_gn | QnA (read only) | 4 | 14-12-2005 07:31 PM |
| a c program.. how to do it??? | anubhav_har | QnA (read only) | 4 | 21-09-2005 11:54 AM |
| new program in 'close program menu' list and more....... | vishakadatta | QnA (read only) | 2 | 12-04-2005 11:33 PM |
| C++ Program Q. | shwetanshu | Programming | 5 | 09-02-2005 01:50 PM |