Return to Snippet

Revision: 67577
at October 8, 2014 05:28 by RaghavSomani


Initial Code
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
int* convert(char* c)
{
	int len=strlen(c),i;
	int *a=(int*)malloc(len*sizeof(int));
	for(i=0;i<len;i++)
		a[i]=c[i]-48;
	return a;
}
int main(int argc, char const *argv[])
{
	char c[100];
	scanf("%s",c);
	int *a=convert(c);
	free(a);
	return 0;
}

Initial URL

                                

Initial Description
To store large numbers into integer array by converting a string into interegr array.

Initial Title
Convert String to integer array

Initial Tags

                                

Initial Language
C