Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #include <stdio.h>
- int main()
- {
- int i;
- char arr[] = {12, 2, 5, 9, 10, 0, 11, 1, 3, 4, 0, 13, 6, 7, 8};
- int Sindex[10][2] = {0};
- int now = 0;
- //////////////////////////////////////////////////////////////
- for( i = 0; i < sizeof(arr); i++ ) {
- if( arr[i] == 0 ) {
- now++;
- continue;
- }
- if( Sindex[now][1] == 0 )
- Sindex[now][0] = i;
- Sindex[now][1]++;
- }
- //////////////////////////////////////////////////////////////
- for( i = 0; i < now+1; i++ ) {
- printf("%d %d\n", Sindex[i][0], Sindex[i][1]);
- }
- return 0;
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement