i've used what you all have given me and its throwing up some errors. additionally, i should've mentioned this before hand, but i don't know exactly what i am recieving after subtracting '0' from the array index.
Code:
Assignment2.c: In function 'string_2_ints':
Assignment2.c:57: warning: passing argument 1 of 'strlen' from incompatible pointer type
Assignment2.c:60: error: invalid operands to binary -
i'm certain its an error on my end.
here are the necessary lines of code.
Code:
#include<stdio.h>
#include<stdlib.h>
#include<string.h>
//Structure declaration
typedef struct {
char first [50];
char second[50];
} data;
void string_2_ints(data numbers[], int num);
//Inside of main
data *numbers;
//num_sets is an integar variable scanned in from the input file
numbers = malloc(sizeof(data)*(num_sets * 2));
string_2_ints(numbers, num_sets);
//Seperate functions after main
void string_2_ints(data numbers[], int num) {
int i, length, digit;
length = 0, digit = 0;
length = strlen(numbers);
for(i = 0; i < length; ++i) {
digit = numbers[i] - '0';
printf("%d\n", digit);
}
}
i apologize for any small errors inside the code as that was transcribed from a computer w/o internet access.
thank you for your time,
-Michael