Jump to content

help a NOOB WITH C

crocski

Also (unrelated) I have realised that when I am inputting data; unless I use near all the array, it wouldn't print them in order.

 

For instance -I have been test the input field with my name which is 7 char long, the array is set to 30, when I am over 10 or higher on all the entries it prints them all back to me in the order I put them in.

 

Why is that?

 

this

               printf(" Sorting Projects ... ");               for (x=0; x<numprojects+1; x++)               for (n=x+1; n<numprojects+1; n++)

should be something like this, i believe

               printf(" Sorting Projects ... ");               for (x=0; x<numprojects-1; x++)               for (n=x+1; n<numprojects; n++)

but now, what's your main problem?

Link to comment
Share on other sites

Link to post
Share on other sites

this

               printf(" Sorting Projects ... ");               for (x=0; x<numprojects+1; x++)               for (n=x+1; n<numprojects+1; n++)

should be something like this, i believe

               printf(" Sorting Projects ... ");               for (x=0; x<numprojects-1; x++)               for (n=x+1; n<numprojects; n++)

but now, what's your main problem?

I think ill just have to occupy of the array for my project file to come back.

though it does not print if I add more than one.

 

how does my code look ?

 

also with my current setup. How can read space in between text

I tried 

char name [30];printf("Enter your name: ");scanf ("%[\^n]", name);printf ( "Name entered : %s");

this works but its self. Doesn't work otherwise.

I dream of 0s and 1s folding to my every command,

algorithms seeping from the back of my head when I need them.

Link to comment
Share on other sites

Link to post
Share on other sites

C is a language that gives you the power to do anything and have control over what you write, but with power comes great responsibility.

With that being said, my input is that you should learn (fully):

 

1) Array manipulation

 

2) Pointer manipulation

 

3) Then when you are confident with 1) and 2) go on to learn Structure manipulation

 

Then you would fully understand why you cannot "see" the problem.

 

Just being helpful here lol because I see these guys posting the answers which are on point but you are still having problems understanding the logic.

 

http://www.tutorialspoint.com/cprogramming/index.htm

------------------------------------

     ~ Live Love Code ~

------------------------------------

Link to comment
Share on other sites

Link to post
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now

×