The Shed is going Social! Join us on FaceBook and Twitter and chime in on the conversation.
|
 |
|
Dev Shed Forums
> Programming Languages
> C Programming
|
Getting user inputs in C programming
Discuss Getting user inputs in C programming in the C Programming forum on Dev Shed. Getting user inputs in C programming C programming forum discussing all C derivatives, including C#, C++, Object-C, and even plain old vanilla C. These languages are low level languages, and used on projects such as device drivers, compilers, and even whole computer operating systems.
|
|
 |
|
|
|
|

Dev Shed Forums Sponsor:
|
|
|

January 2nd, 2013, 11:39 PM
|
|
Registered User
|
|
Join Date: Jan 2013
Posts: 6
Time spent in forums: 1 h 1 m 58 sec
Reputation Power: 0
|
|
Getting user inputs in C programming
I am new to C and I have followed Java before.I study C for my future studies.The problem i get is I cannot input user inputs to an array and print it  .This is my code:-
#include <stdio.h>
int main(void)
{
int arr[3];
int i,j;
for(j=0; j<3; j++){
scanf("%d\n", arr[j]);
}
for(i = 0; i < 3 ;i++)
printf("%d\n",arr[i]);
return 0;
}
can some one help me to correct this please!
|

January 3rd, 2013, 12:56 AM
|
 |
Contributed User
|
|
|
|
|
1. Please use [code][/code] when posting code.
2. scanf("%d\n", arr[j]);
scanf needs a pointer to store each converted result.
So
scanf("%d\n", &arr[j]);
|

January 3rd, 2013, 05:58 AM
|
|
Registered User
|
|
Join Date: Jan 2013
Posts: 6
Time spent in forums: 1 h 1 m 58 sec
Reputation Power: 0
|
|
Quote: | Originally Posted by salem 1. Please use [code][/code] when posting code.
2. scanf("%d\n", arr[j]);
scanf needs a pointer to store each converted result.
So
scanf("%d\n", &arr[j]); |
Thnks for ur answer..I got it..
And i say you I am not an indian 
Is that the way u get ur marks for xm(writing 4n number on ur xm paper ??)
|

January 3rd, 2013, 06:23 AM
|
 |
Contributed User
|
|
|
|
|
It's a signature link, not aimed at you specifically.
It's just for anyone who thinks they can somehow scam their way through an education by either cheating or corruption.
We get a lot of "please do it for me" posts on forums, and the link is a useful reminder for those kinds of people.
|

January 3rd, 2013, 07:04 AM
|
|
Registered User
|
|
Join Date: Jan 2013
Posts: 6
Time spent in forums: 1 h 1 m 58 sec
Reputation Power: 0
|
|
Quote: | Originally Posted by salem It's a signature link, not aimed at you specifically.
It's just for anyone who thinks they can somehow scam their way through an education by either cheating or corruption.
We get a lot of "please do it for me" posts on forums, and the link is a useful reminder for those kinds of people. |
you may be a genius man at computing. you have registered here in 2005.that means you are at least 7 years experienced.As an experienced man do not look at each and every man as cheaters. Think of your early days..You too may have these kind of problems which are little but gives biginer huge headaches.
personally, I am a computer science student currently i am on a vacation after completing first year studies..I studied Java in fist year as a introduction to programming.I have to study the module operating systems in my second year.So i thought to have a knowledge of C language as OS module based on it.
I do not know from where you are.But I have heard of people(mostly from Europe.)who put their assignments on sites(such as Fiverr) and get them completed for money..Mind you,,Lot of Indians work on that sites and do others work for money..(I am not an Indian)..
There are cheaters everywhere..But not all
|
Developer Shed Advertisers and Affiliates
| Thread Tools |
Search this Thread |
|
|
|
| Display Modes |
Rate This Thread |
Linear Mode
|
|
Posting Rules
|
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts
HTML code is Off
|
|
|
|
|