Hello,can someone tell me how i can start taking characters from a certain cell(ex. s[5]) and not from beggining
Thanks in advance
5 replies to this topic
#1
Posted 21 May 2010 - 05:03 AM
|
|
|
#2
Posted 21 May 2010 - 06:37 AM
I presume you run your array through a loop.
So you change the index to 5, instead of 0.
So you change the index to 5, instead of 0.
...
int index;
for (index = 5; index < sizeof(sArray)/sizeof(int); index++) { //code .. }
// d-_-b+
#3
Posted 21 May 2010 - 07:35 AM
I'm working on c,i didnt rly get ur answer :D
I got a char array and i wanna put 100 strings in it
When i get the 1st string i wanna stop to do some checks,is there any way so i can continue getting strings at the point i stopped?
I got a char array and i wanna put 100 strings in it
When i get the 1st string i wanna stop to do some checks,is there any way so i can continue getting strings at the point i stopped?
#4
Posted 21 May 2010 - 07:52 AM
You can make an in int variable which will hold the number of the element which you wish to check/so your stuff with it.
Once you finished, you continue with the number which you stored in that int variable.
Hope you understood what am i trying to say here.
Once you finished, you continue with the number which you stored in that int variable.
Hope you understood what am i trying to say here.
// d-_-b+
#5
Posted 21 May 2010 - 08:09 AM
Its not what i'm looking for,i wanna know if there is any way i can start reading from a certain cell with scanf or any other input command
ex.
i'm using getchar(s) to fill s array,how i can make it start from 5th cell and not from 0?
My enlgish are quite bad so i cant express it like i want ;/ thanks for your time anyway :D
ex.
i'm using getchar(s) to fill s array,how i can make it start from 5th cell and not from 0?
My enlgish are quite bad so i cant express it like i want ;/ thanks for your time anyway :D
#6
Posted 21 May 2010 - 08:19 AM
You can use 'scanf("%s", &stringArray[index])' , or stringArray[index] = getchar() .
One idea that comes into mind is getchars(s), and then copy those value into another array from the 5th element and so on.
Or something like that.
One idea that comes into mind is getchars(s), and then copy those value into another array from the 5th element and so on.
Or something like that.
// d-_-b+
1 user(s) are reading this topic
0 members, 1 guests, 0 anonymous users


Sign In
Create Account

Back to top









