I am quite new in C so I could not fix it. The code below should take a char array (called Rawpack) and getthesign method should return the 10-19 indexed elements of that array. In python I did it using "return [x:y]" However, as I know there is nothing like that in C. I wanted to write the code that makes same thing as my previous python code but it did not work. What is my mistake? If there is a way to use the python version in C can you enlighten me. Thank you.
#include <stdio.h>
#include <stdlib.h>
int main(){
char Sample[] = "nerdesin";
char Checksum[]= "1e052eac";
char Rawpack[]="!neredesin1e052eac#";
char tmpPack[]="";
char ret;
ret=getthesign(Rawpack[])
printf("%c",ret);
}
char getthesign(char package[]){
char Sign;
for(int i=10;i<19;i++)
{
Sign=(package[i]);
//printf("%c",Sign);
}
return Sign;
}
char getthepack(char package[]){
char Pack;
for(int i=1;i<10;i++)
{
Pack=(package[i]);
//printf("%c",getPack);
}
return Pack;
}