Forum     

Go Back   Digit Technology Discussion Forum > Software > Programming
Register FAQ Calendar Mark Forums Read

Programming The destination for developers - C, C++, Java, Python and the lot

Closed Thread
 
LinkBack Thread Tools Display Modes
Old 22-08-2007, 10:30 PM   #1 (permalink)
Dreamweaver
 
Gigacore's Avatar
 
Join Date: Aug 2006
Location: Bangalore
Posts: 3,885
Exclamation Help need for a C program! SOS

Hi guys i'm new to C programming. I've a small assignment program,

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
Gigacore is offline  
Advertisements. Register and be a member of the community to get rid of them.
Advertisement

Old 22-08-2007, 10:40 PM   #2 (permalink)
God of Mistakes...
 
Garbage's Avatar
 
Join Date: Dec 2005
Location: Pune, Maharashtra
Posts: 1,905
Default Re: Help need for a C program! SOS

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_
Garbage is offline  
Old 22-08-2007, 10:47 PM   #3 (permalink)
Dreamweaver
 
Gigacore's Avatar
 
Join Date: Aug 2006
Location: Bangalore
Posts: 3,885
Default Re: Help need for a C program! SOS

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
Gigacore is offline  
Old 22-08-2007, 10:54 PM   #4 (permalink)
Hey here is the aks
 
arunks's Avatar
 
Join Date: Jan 2006
Location: punjab
Posts: 801
Default Re: Help need for a C program! SOS

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
arunks is offline  
Closed Thread

Bookmarks

Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On


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


All times are GMT +5.5. The time now is 03:34 PM.


Powered by vBulletin® Version 3.8.7
Copyright ©2000 - 2012, vBulletin Solutions, Inc.

Search Engine Optimization by vBSEO 3.3.2